/en-tutor-prep-s3-ict-python-loops-functions-practice-2/
/en-tutor-prep-s3-ict-python-loops-functions-practice-2/
General Inquiry: info@TutorZone.com.hk
Office Hours: Monday to Saturday - 9:00 AM to 6:00 PM
WhatsApp Monday to Sunday - 24 hours
Hotline: +852 6828 1809
Instant Support: +852 9061 3106

Paper 2: Advanced: nested loops, defaults and break

Paper 2: Advanced: nested loops, defaults and break

  • 2026-11-21

Paper 2: Advanced: nested loops, defaults and break

Chapter practice with ten items, answers and a one-line note for each, about 25 minutes.

Paper 2 Ten items on this chapter with answers for immediate marking.

01 Paper details (check answers afterwards)

Item Detail
Questions 10
Suggested time 25
Difficulty mix Foundation 4 · Intermediate 2 · Challenge 2 · Error redo 2
Chapter Chapter: S3 ICT: Python loops and functions
Level Advanced

02 Questions (10 items)

  1. FoundationAfter `total = 0` and `for i in range(1, 21, 3): total += i`, what is total?
  2. FoundationAn outer `for i in range(3)` holds an inner `for j in range(4)`. How many times does the inner body run?
  3. FoundationGiven `def power(base, exp=2): return base ** exp`, what do `power(5)` and `power(2, 3)` give?
  4. FoundationUse a while loop to count the digits of 4728. What is the answer?
  5. IntermediateUse a for loop to compute 5 factorial. What is the result?
  6. IntermediateHow many multiples of 7 lie between 1 and 100 inclusive?
  7. ChallengeAdd the items of the list `[12, 8, 15]` with a for loop. What is the total?
  8. ChallengeGiven `def bigger(a, b): return a if a > b else b`, what does `bigger(9, 4)` give?
  9. Error redoInside `for n in range(10, 40):` the body runs `if n % 7 == 0: print(n); break`. What prints?
  10. Error redoA function only calls print and never uses return. What value does the call give back?

03 Answers and one-line notes

# Answer One-line note
1 70. The values are 1, 4, 7, 10, 13, 16 and 19, and they sum to 70.
2 Twelve times. The inner loop finishes four rounds for every outer round, so 3 x 4 = 12.
3 25 and 8. exp falls back to the default 2, and passing 3 overrides that default.
4 Four digits. Each round does n = n // 10 and adds one to the counter, so 4728 reaches 0 after four rounds.
5 120. 1 x 2 x 3 x 4 x 5 = 120.
6 Fourteen. 100 / 7 is 14 remainder 2, so fourteen multiples fit inside the range.
7 35. 12 + 8 + 15 = 35, and the accumulator must start at 0.
8 9. The conditional expression returns a when a > b holds.
9 14. break leaves the whole loop at once, so only the first match prints.
10 None. Any function without return hands back None; print only displays text.

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.

Want the whole chapter? See all four difficulty papers on the chapter page.Tutor 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.

Join as a tutor or coach — academic, music, sports, arts, STEM. Free to register. See how it works →