Font size
WorksheetsFor Loops ( Review )
Total questions: 26
Worksheet time: 16mins
Look at the following code, what will it generate
1,2,3,4,5,6,7,8,9,10,11,12
0,1,2,3,4,5,6,7,8,9,10,11,12
1,2,3,4,5,6,7,8,9,10,11,12,13
0,1,2,3,4,5,6,7,8,9,10,11,12,13
What does the following program display?
1,2,3,4
1,2,3,4,5
counter,counter,counter,counter,counter
0,1,2,3,4,5
1,2,3,4
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
if you wished a loop to repeat 3 times what should you use?
For counter in range(0,5):
For counter in range(1,3):
For counter in range(0,3):
what is the name of the variable used in the following code?
counter
for
#
Which of the following is an acceptable variable name?
no-text
8text
no_text
no_text$
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
The equivalent of the above for loop using the while syntax would be
The program above prints
Numbers between 1 and 100 that are multiples of 5
Numbers between 1 and 100
Numbers between 1 and 100 divisible by 5
Numbers between 1 and 101 that are multiples of 5
4
3
2
1
3
2
1
0
4
3
2
1
3
2
1
0
4
3
2
1
3
2
1
0
1. Grip cap with index finger and thumb
2. Remove cap
3. Twist counter-clock-wise until seal is broken
