W WolfCode · CSC 141
Chapter 09

Recursion

递归

A function calls itself. With a base case to stop, recursion is the cleanest way to express problems that are naturally self-similar — factorial, fibonacci, list traversal, Euclid’s GCD. Strictly aligned with Think Python §5.7-§5.10 + §6.6-§6.9.

Strict source: Think Python §5.7-§5.10 + §6.6-§6.9

Lessons in this chapter

  1. 09.00 Worked Example
    Walkthrough: Recursive Countdown
    例题: 递归倒计时
    python-recursion
    8 min
  2. 09.01 Exercise
    Factorial
    阶乘
    python-recursion
    15 min
  3. 09.02 Exercise
    Fibonacci
    斐波那契数列
    python-recursion
    20 min
  4. 09.03 Exercise
    Sum List Recursively
    递归求列表和
    python-recursion python-lists
    15 min
  5. 09.04 Homework
    Homework: GCD + Power
    作业: 最大公约数 + 幂
    python-recursion
    45 min