Worksheetsfor loops
Total questions: 7
Worksheet time: 5mins
This statement is used to allow a program to repeat a task for a specific number of times
if
for
while
range() function is used to create a sequence of numbers.
Write the range() function to create this sequence: [0, 1, 2, 3, 4]
range(0, 1, 2, 3, 4)
range(5)
range(4)
range(0, 4)
range() function is used to create a sequence of numbers.
Write the range() function to create this sequence: [2, 3, 4, 5, 6]
range(2, 3, 4, 5, 6)
range(2, 6)
range(2, 7)
range(5)
range() function is used to create a sequence of numbers.
Write the range() function to create this sequence: [2, 4, 6, 8]
range(2, 4, 6, 8)
range(2, 8)
range(2, 9)
range(2, 9, 2)
range(2, 8, 2)
What will be displayed after the program is executed?
1 2 3 4 5
1
2
3
4
5
0 1 2 3 4
0
1
2
3
4
What will be displayed after the program is executed?
0
1
2
3
4
5
1
2
3
4
5
1
2
3
4
5
6
0
1
2
3
4
What will be displayed after the program is executed?
2
15
3
2
5
8
11
14
Hi
Hi
Hi
Hi
Hi
Hi
Hi
Hi
my brain hurts
