Caffeinated Coder
Book an appointment
Lesson 09 · First steps in code

Functions: reusable steps

A function is a set of steps with a name. You write the steps once with def, then run them whenever you need them by calling the name. Step through a two-line function, area(w, h), called twice, and watch where Python goes: into the function, back out with an answer, and what happens to its local variables along the way.

10 min10 steps5 questionsBeginner
Fig 9 · Interactive
Loading figure…
or ← →

Quiz Unlocks after the last step.