This week’s topics
Repeating code: while loops
- Loops that stop on a condition
- Avoiding endless loops
What you will be able to do
- 2.2 Implement sequence, selection, and iteration structures.
Activity
Write a number-guessing game.
Study materials
Further resources
- Introduction to Python Programming, 5.1: While loop · PDF · OpenStax Introduction to Python Programming (2024), 5.1: while loops that stop on a condition, pp. 115–117 · for registered students
- Introduction to Python Programming, 5.4: Break and continue · PDF · OpenStax Introduction to Python Programming (2024), 5.4: controlling loops and avoiding endless loops, pp. 127–129 · for registered students
- Think Python, ch. 7: Iteration · PDF · Downey, Think Python 2e (Green Tea Press), ch. 7: the while statement and break, pp. 63–70 · for registered students
- Understanding loops: what are the misconceptions of lower-secondary pupils? · Open-access article · Vaníček et al. (2023), Informatics in Education. Common misconceptions about loops, including when a loop stops. · for registered students
Materials marked “for registered students” open in the student portal, which is set up as soon as you receive final acceptance.