Iteration: AQA GCSE practice
for and while loops, counting and totals. 16 questions in the style of the AQA GCSE exam.
Sample questions
How many times does the body of `for i in range(2, 8):` run?
- 5
- 6
- 7
- 8
Which of these loops is condition-controlled?
- for i in range(10):
- for letter in word:
- while guess != secret:
- for i in range(len(items)):
What does this program print?
total = 0
for i in range(1, 5):
for j in range(i):
total = total + j
print(total)