← Edexcel International GCSE

Iteration: Edexcel International GCSE practice

for and while loops, counting and totals. 12 questions in the style of the Edexcel International GCSE exam.

Sample questions

How many times does the body of `for i in range(2, 8):` run?

  1. 5
  2. 6
  3. 7
  4. 8

Which of these loops is condition-controlled?

  1. for i in range(10):
  2. for letter in word:
  3. while guess != secret:
  4. 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)