📜 Recipes for machines
Why: Think in algorithms — precise recipes a machine can follow.
Unlocks: Your first real code, in Python: First Steps.
A list of exact steps for getting something done has a fancy name: an algorithm. A cake recipe is an algorithm. Assembly instructions are an algorithm. "Turn left at the bakery, second house on the right" is an algorithm.
The catch, as you know from lesson one, is that the machine follows your steps exactly and literally. Tell it "spread peanut butter on the bread" and forget "open the jar first", and a human fills the gap — the machine smashes the closed jar onto the loaf. Programming, which you'll meet soon, is mostly the art of writing recipes with no gaps.
But here's the beautiful part: some recipes are dramatically cleverer than others. The best way to feel it is to watch one work on you:
Think of a number between 1 and 100. Don't tell me! I'll guess it in 7 questions or fewer — every single time. Ready?
Why cleverness beats speed
The dumb recipe — "is it 1? is it 2? is it 3?…" — needs up to 100 questions. Halving needs 7. For a billion possibilities, the dumb way needs up to a billion questions; halving needs just 30. Thirty.
That's why algorithms matter: raw speed gets multiplied by clever recipes. When a search engine finds your answer among billions of pages in a heartbeat, you're seeing both superpowers at once — a fast machine following a brilliant recipe.
What is an algorithm?
The mind reader found your number among 100 in 7 questions. Among 1,000 numbers, roughly how many questions would halving need?