NEW
Font size
WorksheetsLoops
Total questions: 10
Worksheet time: 5mins
To repeat a fixed number of times use a
while loop
if loop
for loop
indentation
To repeat until a particular condition is true use
while loop
if loop
for loop
indentation
The character that must be at the end of the line for if, while, for etc.
;
+
\;
:
How many times does the following program print the word ‘computer’:
word= "computer"
for num in range(1,6):
print(word)
1
5
6
0
In programming, what is iteration?
The repetition of steps within a program
A decision point in a program
The order in which instructions are carried out
Testing a program to make sure it works
Why is iteration important?
It determines the order in which instructions are carried out
It allows multiple paths through a program
It allows code to be simplified by removing duplicated steps
It ensures the code works correctly
Which two statements are used to implement iteration?
IF and WHILE
FOR and WHILE
ELSE and WHILE
IF and ELSE
Which type of loop iterates until instructed otherwise?
FOR loop
Repeat-once loop
WHILE loop
A count-controlled loop
The condition for a while loop to continue could include which of the following?
While something equals something
While something is greater than something
While something is True
All of these
Which of the following symbols is used in Python to mean "Equal to"?
=
==
!=
>=
