P41 · Functions & Reuse

calling built-in functions, writing a tiny one, doing something to every item (a loop), choosing with if — the mechanics of automation, gently

The mechanics of automation, gently: call functions, write a tiny one of your own, repeat work over every item with a loop, and choose with if.

So far the notebook has mostly answered you one line at a time: in P39 you learned to run cells and read what comes back, and in P40 you met the shapes your material takes — text, numbers, lists, tallies. This pillar is where the notebook starts working for you. The idea is simple and old: give a chore a name, and from then on one word does the whole job.

Two short tracks carry it. Using Functions shows you have been calling tools all along — len, sorted — and that writing one of your own is two lines, not a career change. Repeating & Choosing adds the two moves behind every automation: a loop that applies your tool to every item in a list, and if, which decides which items deserve it. Four small ideas in total — once they feel comfortable, the capstone in P42 is assembly, not new theory.

Call a toollen, sorted, ready-madeWrite your owntwo lines and a nameLoop itsame move, every itemChoose with ifkeep some, skip some
The four moves of this pillar - each is one short module.