WorksheetsPython Quiz - 6
Total questions: 10
Worksheet time: 5mins
Which kind of loop would be used?
I need a program that will keep letting me add money to a piggy bank until I get to £100.
FOR Loop
WHILE Loop
Which of the following is the definition of Indentation in terms of programming
Repetition of a sequence, usually with some change
A gap at the start of a line of code
A line of code that includes a condition, followed by lines of code that only run if the condition is met
Repetition of the first letter at the start of each word in a sentence
What will happen when this program runs
It will display numbers 0-10 on separate lines
It will display numbers 0-9 on separate lines
It will crash
It will display 0s in an infinite loop
4
3
2
1
3
2
1
0
In a While loop a code will be repeated until the condition becomes
FALSE
TRUE
User choice
What would be the output of the following code:
for i in range(3):
print(5)
0 1 2
3 3 3 3 3
5 5 5
0 1 2 3 4
for i in 100 :
print ( i )
Syntax error
prints numbers 0 to 100
prints numbers 1 to 100
prints numbers 0 to 99
prints numbers 1 to 99
Three of the for loops below will provide identical values for i. Which for loop will provide values that do not match the others?
for i in range(0, 5):
for i in range(5):
for i in range(0, 5, 1):
for i in range(5, 0, 1):
