loop
Functions

Module 4 · Functions · Lesson 2 of 4

Decomposition

Big problems are overwhelming when you stare at them whole. The trick that every programmer leans on is decomposition: split the big job into a handful of smaller jobs, each simple enough to hold in your head — and make each one a function.

One big job → small named steps
make_breakfast()
↓ broken into
brew_coffee()toast_bread()fry_egg()

Each small step is easy to write, name, test and reuse — and the big job becomes just a list of calls.

“Make breakfast” is vague and daunting. But brew_coffee, toast_bread and fry_egg are each small, clear, and easy to get right on their own. Solve the small pieces, and the big one assembles itself.

Run it yourselfruns in your browser · Python
main.py

Notice how make_breakfast reads almost like plain English — a list of named steps. That's the real payoff: well-decomposed code documents itself. Each piece can be written, tested and fixed alone, and a function you got right once can be reused in the next program too.