Stage 2 · Intermediate · F5
Speaking to machines
Under the hood, a model is mostly arithmetic on grids of numbers, and you can learn to write it.
13 lessons · 110 minGentle
About this chapter
You can start from nothing, with no setup and no experience. You will name values, walk a list, choose with a condition, write a recipe of your own, and read an error without flinching. Then numbers arrive in grids, arithmetic hits a whole grid at once, and a picture comes out the other end.
What you will be able to do
- 17 min
What a program is
Say what a program is and predict the order its lines run in.
- 28 min
Values and names
Give a value a name, reuse it, and say when a name may change.
- 38 min
Numbers and text
Tell a number from text and predict what the plus sign will do.
- 48 min
Lists
Build a list, reach any item by its position, and count from zero.
- 59 min
Do this for every item
Write a loop over a list and say what the body does on each pass.
- 68 min
Choosing
Write a condition, read what it returns, and keep only the items you want.
- 79 min
Named recipes
Write a function, call it with different inputs, and hand a result back.
- 88 min
Reading an error without fear
Read the three parts of an error message and find the line that caused it.
- 910 min
A grid of numbers
Read a shape out loud and reach any number in a grid by its address.
- 109 min
Math on everything at once
Do arithmetic on a whole grid in one line and predict the shape that comes out.
- 118 min
Draw it before you trust it
Draw a set of numbers and name something the summary hid.
- 129 min
One small experiment
Load real numbers, check them, compute one thing, and draw the result.
- 139 min
Reading other people's code
Work out what an unfamiliar snippet does without asking its author.
Before you start
Nothing to learn first. You can start here.