CSC 141 / CLASS 10 / INTERACTIVE

Where does a variable live?

Step through the four programs from Class 10 one line at a time. Every function call gets its own box, called a frame. Watch which box each variable goes into, and watch the box disappear when the function returns. Pick a variable name above the code to shade its scope, the lines where that name can be used.

Use Next and Back, or the ← and → keys. Make your prediction before you step. Ungraded practice; nothing is recorded.

Course home · Python Playground (Class 10)

FRAMES (MEMORY)

OUTPUT

Exit ticket

The same three questions from the end of the slides. Answer each, then check.