Functions are values

A function is an object like any other. You can assign it to a name, put it in a list or dict, pass it to another function, and return it from one. Without parentheses, shout is the function. With them, shout("hi") calls it.

Storing functions in a dict is a clean way to replace a long if/elif chain. A calculator, a command dispatcher, or a state machine often looks like handlers[op](a, b).

Passing a function in is how sorted, max, and map let you customise them, and returning a function is the basis of closures and decorators, coming up soon.

A common bug: writing button.on_click(handle()) instead of button.on_click(handle). The first calls handle now and passes its result.

Run it, then add a "%" operation to OPS.