Textbook section
Week 2: Iteration
Read the chapters for Week 2 as clean web pages with navigation, code blocks, and section links.
Ch. 6: while Loops — Indefinite IterationChapter 6: while Loops — Indefinite IterationConsider this problem: print every integer from 1 to 1,000,000.
Ch. 7: for Loops and range() — Definite IterationChapter 7: for Loops and range() — Definite Iterationwhile loops are ideal when you don't know in advance how many times you'll
Ch. 8: Nested Loops and Iterating Over StringsChapter 8: Nested Loops and Iterating Over StringsIn Chapter 7, you looped over a string using indices:
Ch. 9: Approximation and Brute-Force SearchChapter 9: Approximation and Brute-Force SearchSo far, every problem in this course has had a direct formula: compute area
Ch. 10: Loop Patterns, break, continue, and FlagsChapter 10: Loop Patterns, break, continue, and FlagsSo far, every loop you've written runs its full course — the while