Repeated work
Level 1 · estimatedRepeat 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
Read the whole unit on one page
- Read a for loopLevel 1 · Foundations
- Choose the bounds of rangeLevel 1 · Foundations
- Trace a while loopLevel 1 · Foundations
- Keep a running totalLevel 1 · Foundations
- Stop a search at a matchLevel 1 · Foundations
Sources
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.