6. Scope

Where variables live

Variables made inside a function stay inside it (they're local). A function can read variables from outside. Numbers passed in are copies — but a list passed in is the same list.

🎯 0/4 · 🥁 0 solved · 🏅 0

Challenge A:def f(): sets b = 5 and plays kick(b). Outside, b = 3. Call f(), then play snare(b).

Goal
snare
kick
1234
5678