Quarry School

Repeated work

Subject: ComputingLevel 1 · estimated

Repeat a block of lines with for and while loops. Choose where a range starts and stops, keep a running total and stop a search at the first match, and predict each result before you run the program.

Lessons

Quick review

Read the whole unit on one page

  1. Read a for loopSubject: ComputingLevel 1 · Foundations
  2. Choose the bounds of rangeSubject: ComputingLevel 1 · Foundations
  3. Trace a while loopSubject: ComputingLevel 1 · Foundations
  4. Keep a running totalSubject: ComputingLevel 1 · Foundations
  5. Stop a search at a matchSubject: ComputingLevel 1 · Foundations

Sources

  1. Python 3.13 Tutorial, 4.2 for Statements. Python Software Foundation. Python Software Foundation License Version 2. Read 2 Dec 2026. Cited in Read a for loop, Choose the bounds of range, Trace a while loop.
  2. Python 3.13 Language Reference, 8.3 The for statement. Python Software Foundation. Python Software Foundation License Version 2. Read 2 Dec 2026. Cited in Read a for loop, Choose the bounds of range, Keep a running total, Stop a search at a match.
  3. Python 3.13 Tutorial, 3.2 First Steps Towards Programming. Python Software Foundation. Python Software Foundation License Version 2. Read 2 Dec 2026. Cited in Read a for loop, Trace a while loop, Keep a running total.
  4. Python 3.13 Tutorial, 4.3 The range() Function. Python Software Foundation. Python Software Foundation License Version 2. Read 2 Dec 2026. Cited in Choose the bounds of range.
  5. Python 3.13 Library Reference, Built-in Types: Ranges. Python Software Foundation. Python Software Foundation License Version 2. Read 2 Dec 2026. Cited in Choose the bounds of range, Keep a running total.
  6. Python 3.13 Language Reference, 8.2 The while statement. Python Software Foundation. Python Software Foundation License Version 2. Read 2 Dec 2026. Cited in Trace a while loop, Stop a search at a match.
  7. Python 3.13 Library Reference, Built-in Exceptions: KeyboardInterrupt. Python Software Foundation. Python Software Foundation License Version 2. Read 2 Dec 2026. Cited in Trace a while loop, Stop a search at a match.
  8. Python 3.13 Library Reference, Built-in Functions: input. Python Software Foundation. Python Software Foundation License Version 2. Read 2 Dec 2026. Cited in Trace a while loop, Keep a running total, Stop a search at a match.
  9. Python 3.13 Language Reference, 7.2.1 Augmented assignment statements. Python Software Foundation. Python Software Foundation License Version 2. Read 2 Dec 2026. Cited in Keep a running total.
  10. Python 3.13 Language Reference, 8.1 The if statement. Python Software Foundation. Python Software Foundation License Version 2. Read 2 Dec 2026. Cited in Keep a running total, Stop a search at a match.
  11. Python 3.13 Library Reference, Built-in Functions: int. Python Software Foundation. Python Software Foundation License Version 2. Read 2 Dec 2026. Cited in Keep a running total, Stop a search at a match.
  12. Python 3.13 Tutorial, 3.1.1 Numbers. Python Software Foundation. Python Software Foundation License Version 2. Read 2 Dec 2026. Cited in Keep a running total.
  13. Python 3.13 Tutorial, 4.4 break and continue Statements. Python Software Foundation. Python Software Foundation License Version 2. Read 2 Dec 2026. Cited in Stop a search at a match.
  14. Python 3.13 Language Reference, 7.9 The break statement. Python Software Foundation. Python Software Foundation License Version 2. Read 2 Dec 2026. Cited in Stop a search at a match.