S5 ICT Programming Loops, Paper 1: range, while and nesting
- 2026-11-02
S5 ICT Programming Loops, Paper 1: range, while and nesting
Paper 1 starts from the start, stop and step of range and works out five printed lines, a total of 55 from 1 to 10, four rounds with a step of 3 and a while loop ending at 5, then six multiples of 3, twelve nested iterations, an even sum of 2550, eight Collatz steps and a countdown leaving i at 1.
Reminders The upper limit of range is exclusive, a while loop must eventually turn false, and nested totals multiply outer by inner.
01 Paper details (check answers afterwards)
| Item | Detail |
|---|---|
| Questions | 10 |
| Suggested time | 25 |
| Difficulty mix | Foundation 4 · Intermediate 3 · Challenge 2 · Error redo 1 |
| Chapter | Chapter: S5 ICT: Programming Loops in Python |
| Level | S5 |
02 Questions (10 items)
- FoundationHow many lines does `for i in range(1, 6): print(i)` print?
- FoundationWith `total = 0` and `for i in range(1, 11): total += i`, what is total at the end?
- FoundationHow many times does `for i in range(0, 10, 3)` iterate?
- Foundation`count = 0` then `while count is below 5: count += 1`. What is count when the loop ends?
- IntermediateIn `for i in range(2, 21): if i % 3 == 0:`, how many times is the condition true?
- IntermediateIn the nested loops `for i in range(3): for j in range(4):`, how many inner iterations in total?
- Intermediate`s = 0` then `for i in range(1, 101): if i % 2 == 0: s += i`. What is s?
- ChallengeStarting at n = 6, repeat halving when even and 3n + 1 when odd until n = 1. How many steps?
- Challenge`for i in range(5, 0, -1): print(i)` prints how many lines, and what is i afterwards?
- Error redoError repair: a student said `range(1, 5)` gives 1, 2, 3, 4, 5, five numbers. How many is it really?
03 Answers and one-line notes
| # | Answer | One-line note |
|---|---|---|
| 1 | 5 lines (1 to 5) | range(1, 6) starts at 1 and stops before 6, so it prints 1 to 5, five numbers in total. |
| 2 | 55 | Summing 1 to 10 gives 55 because range(1, 11) covers exactly the ten numbers 1 to 10. |
| 3 | 4 times | A step of 3 gives 0, 3, 6 and 9; the next value 12 is past the limit, so there are 4 iterations. |
| 4 | 5 | The loop continues while count is below 5, so it stops once count reaches 5 and leaves 5 behind. |
| 5 | 6 times | The multiples of 3 from 2 to 20 are 3, 6, 9, 12, 15 and 18, six in all. |
| 6 | 12 | The outer loop runs 3 times and the inner loop 4 times each round, so 3 times 4 gives 12. |
| 7 | 2550 | The even numbers from 1 to 100 sum to 2 plus 4 up to 100, which is 2 times 1275, giving 2550. |
| 8 | 8 steps | The chain 6 to 3 to 10 to 5 to 16 to 8 to 4 to 2 to 1 needs 8 steps; this sequence is the Collatz sequence. |
| 9 | 5 lines, i is 1 | Counting down from 5 to 1 gives 5 lines, and Python keeps the last value after the loop, so i is 1. |
| 10 | 4 (1 to 4) | The upper limit of range is exclusive, so range(1, 5) holds only 1, 2, 3 and 4. |
04 What to do after marking
- After marking, redo only the wrong items and write down which step went wrong (formula, unit, or misread number).
- Repeat the same item two days later; move to the next paper only when both attempts are correct.
- Parents only need the answer and note columns; there is no need to explain every item.
Book an S5 ICT tutorTutor Registration →
Questions and answers are written originally by the TutorZone team and are not taken from any school, publisher or examination authority paper. Every value is checked by computer.


