COSC 1210 · CS I (Python) · Countdown

Recursion Stepper: Watch the Stack

Step through a recursive function one line at a time. Every call gets its own frame with its own n; the frames pile up until the base case, then unwind in reverse order. Before each step, predict what happens next.
n = 3
Code
Stack · one frame per active call
Output ↓ printed on the way down ● base case ↑ printed on the way back up

Keyboard: → or space step, ← back, p play/pause, r reset. The stack is drawn like a traceback and like the slides: __main__ on top, the call that is running now at the bottom.

Built to accompany COSC 1210 (CS I, Python), lecture “Countdown”. The steps are generated live for whatever n you pick — it is the same sequence Python goes through, not a canned animation. For any code of your own, step through it in pythontutor.com.