Professional Documents
Culture Documents
03 - For Loops
03 - For Loops
Program Output
for x in range(1,10):
print(x)
for x in range(1,10,2):
print(x)
for x in range(100,0,-10):
print(x)
for x in range(0,21,5):
print(x)
Page 1
© Nichola Lacey 2018
Correcting Code
The user wants to display a count down from 10 to 1 and then display “Blast Off” but the following
code is not working. Why is this.?
1. Create a program that will ask the user to a word and display that word 5 times.
2. Create a program that will ask the user to input a number and their name and display their
name that number of times.
3. Create a loop that will create a variable called total which will have a starting value of 0. Use
a loop to ask the user to enter three numbers and add them to the total. At the end display
the total.
4. Ask the user to enter a word and display each letter in that word on a separate numbered
line. For instance if they enter “hello”, it should display:
Page 2
© Nichola Lacey 2018