Week 5: Loops
Learning Objectives
By the end of this week, students will be able to:
- Use
forloops to repeat a task over a known collection or range of values - Use
whileloops when repetition depends on a changing condition - Update variables correctly inside a loop
- Recognize and avoid common loop errors such as off-by-one mistakes and infinite loops
Perspectival Reading
Reading: TBD
Reflection Questions
- When is repetition better expressed with a loop than by copying code?
- Why are off-by-one errors so common in looping problems?
- What strategies help you debug a loop that does not stop when expected?
Slides
Lab Assignment
Week 5 Lab — GitHub Classroom (link TBD)