Series overview

Python Bakery

Scopes and bodies

This lesson distinguishes a function’s body, the indented block that runs, from its scope, the region where a variable exists. Students learn the difference between global and local variables, why functions return values rather than variables, and why global variables are discouraged except as constants.