W WolfCode · CSC 141
Chapter 03

Loops

循环

Do something many times. for / range, while, break — and the four patterns (accumulator, counter, tracking variable, while-true) that cover 95% of beginner loops. Strictly aligned with Think Python §7.1–§7.4.

Strict source: Think Python §7.1–§7.4 (Multiple Assignment · Updating Variables · The while Statement · break).

Lessons in this chapter

  1. 03.00 Worked Example
    Walkthrough: Countdown
    例题: 倒计时
    python-loops
    8 min
  2. 03.01 Exercise
    Sum 1..n
    1 到 n 求和
    python-loops
    15 min
  3. 03.02 Exercise
    FizzBuzz
    FizzBuzz
    python-loops python-conditionals
    20 min
  4. 03.03 Exercise
    Find the Max
    找最大值
    python-loops
    15 min
  5. 03.04 Homework
    Homework: Collatz Steps
    作业: Collatz 步数
    python-loops python-conditionals
    30 min