We're Open
+44 7340 9595 39
+44 20 3239 6980

# Conditional Iterations and Loops

100% Pass and No Plagiarism Guaranteed

# Conditional Iterations and Loops

INSTRUCTIONS:

Module 3 - SLP

CONDITIONAL, ITERATIONS, AND LOOPS

Use Python to run the following .py Files with the original values and statements. Next, change some of the values to the following. Please keep in mind that statements may change accordingly once you modify the programs. The modified programs must execute correctly.

Code is adapted from MITOpenCourseWare, “A gentle introduction to programming using Python” (under the Open Education Consortium Global Network for Open Education and authorized by the creative commons license).

For Example 1, change 56” to 65” and 150 to 175

For Example 2, change 9 > 5 to 5 < 9

For Example 3, change the string ‘Hello, world’ to ‘You are welcome!’ and for the while loop example, change counter from 100 to 25. You may change any the loop examples and values to an integer of your choice.

1 - Height Example .py File

# Lecture 3

#height_example.py

# Problem Statement:

# If you`re taller than 56", you can ride Space Mountain at Disneyland.

# If you`re shorter, you cannot.

# Additionally if you are greater than 150 inches, you are super tall and

# deserve a witty message.

# Get user`s height

height = input("How tall are you? ")

# Do this if statement first

if height > 150:

print "wow you`re tall!"

# Do this one second - so people who are tall get the witty message

# AND get permission to ride the ride

if height >= 56:

print "ok"

else:

print "too short"

2 - Conditional Example .py File

# Lecture 3

# conditional_examples.py

# Boolean math

# Examples of if statements

# General format:

# if :

#

if 9 > 5:

print "Yes, 9 greater than 5"

if 9 != 5:

print "Yes, 9 not equal to 5"

# An example of an if/else statement

# General format:

# if :

#

# else:

#

#if 9 < 5:

# print "Yes, 9 less than 5"

#else:

# print "No, 9 is not less than 5"

# An example using "not" and "and" keywords

#if not (10 == 4) and 9 > 5:

# print "Yay, basic math competency achieved!"

#else:

# print ":("

# Traffic light example

#light_color = raw_input("What color is the traffic light? ")

#light_color = light_color.lower()

#print light_color

#if light_color == "red":

# print "You should stop"

#elif light_color == "yellow":

# print "Slow down!"

#elif light_color == "green":

#else:

# print "What country are you in""

3 - Loop Example .py File

# Lecture 3

# loop_examples.py

# An example of a for loop

# A string

hello_world = `hello, world!`

# Initalize a variable to hold a count of letters

letter_count = 0

# Go through all the letters in a string

for letter in hello_world: # Remember the colon!

# Print out the position of each letter

print "Letter number", letter_count, "is", letter

# And increment the counter

letter_count = letter_count + 1 # Can also do letter_count += 1

# Finally print how many letters were in the string

print "There were", letter_count, "letters in the string", hello_world

# For loop examples using range:

# Range with 1 argument goes from 0 through n-1

#for num in range(10):

# print num

# Range with 2 arguments goes from the first number through the last-1

#for num in range(7, 15):

# print num

# Range with 3 arguments goes from the first number through the

# second-1, in increments determined by the third number

#for num in range(2, 12, 2): # What happens if the 3rd number is negative?

# print num

# A while loop example

# Initialize a counter

#count = 1

#print "Count is initially", count

# Want to keep looping until the counter is bigger than 100

#while count < 100:

# count = count * 9

# print "Now count is", count

# When we get here, the while loop is done - so count must be > 100

#print "the counter is", count

Once you have executed these programs (1 - Height Example; 2 - Conditional Example; and 3- Loop Example), modify the .py files according to the instructions given to revise the code by program examples. You need to run the IDLE to execute the program changes and review the program results.

You can use the Snipping tools or screen print (ctrl + Print Screen) to show the Pythons editor’s (IDLE) code and results and demonstrate that your program executed correctly.

Create a submission file named as “ITM205-SLP3-Exercises-YourFirstNameLastName “containing executed programs (.py files) for 1 - Height Example; 2 - Conditional Example; and 3- Loop Example.

Write a summary document in Microsoft Word format named as “ITM205-SLP3-Summary-YourFirstNameLastName” to show what you have accomplished.

CONTENT:

CONDITIONAL, ITERATIONS, AND LOOPS Name: Institution: Sum

...

100% Plagiarism Free & Custom Written,

International House, 12 Constance Street, London, United Kingdom,
E16 2DQ

## STILL NOT CONVINCED?

View our samples written by our professional writers to let you comprehend how your work is going to look like. We have categorised this into 3 categories with a few different subject domains

View Our Samples

#### We offer a £ 2999

If your assignment is plagiarised, we will give you £ 2999 in compensation

Sep,30,2021

Sep,30,2021

Sep,30,2021

### Details

• Title: Conditional Iterations and Loops
• Price: £ 99
• Post Date: 2021-08-13T11:55:34+00:00
• Category: Essays
• No Plagiarism Guarantee
• 100% Custom Written

### Customer Reviews

Conditional Iterations and Loops
Reviews: 5

### A masterpiece of assignment by Cheng , written on 2020-03-12

I ordered the literature review for my research project in rush delivery. I was not expecting that they would complete my order 2 hours before my chosen time. The quality is also nice. Thank you for help.
Reviews: 5

### A masterpiece of assignment by Rabail , written on 2020-03-12

I received my order last night and now I’m writing my reviews. My assignment has all the points I needed along with a good style. The citations used are relatable and professional. The best thing is the discount I got because I recommended my friend too to use their service. I am so pleased to use this effective service. The features are also amazing, everything is good. Will come again soon!