NEW
Font size
WorksheetsPython Loop
Total questions: 15
Worksheet time: 12mins
An infinite loop is :A loop runs infinite times when the condition-------------.
never fails
run one time
Print i as long as i is less than 6 and i is initiated with the value of 1 :
Which program is correct
In Python while loop It continually executes the statements(code) as long as the given condition is ----------
True
False
FOR loops are
loops which run an unknown number of times
loops which run for a specific number of times
the same as if statements
not part of programming
WHILE loops are
loops which run an unknown number of times
loops which run for a specific number of times
the same as if statements
not part of programming
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 kind of loop would be used?
I need a program that will keep letting me add a monthly payment for 12 months.
FOR Loop
WHILE Loop
Which kind of loop would be used?
I need a guessing game program that will let me keep guessing until I get the right answer.
FOR Loop
WHILE Loop
Score = Score + 1
C
C
When do you know when you come to the end of the loop?
Its states End loop
The command End is given
The indentation stops
numbers = [5, 14, 9, 17]
for number in numbers:
if number % 3 == 0:
print(number)
The output will be?
17
9
14
9
17
14
17
What is the output of the following code?
i = 5
while i >= 0:
print(i)
i = i - 1
5 4 3 2 1 0
5 4 3 2 1 -1
5 4 3 2 1 -2
5 4 3 2 1 -3
