Skip to content

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

  1. 1

    What a Program Is

    Say what a program is and predict the order its lines run in.

    7 min
  2. 2

    Values and Names

    Give a value a name, reuse it, and say when a name may change.

    8 min
  3. 3

    Numbers and Text

    Tell a number from text and predict what the plus sign will do.

    8 min
  4. 4

    Lists

    Build a list, reach any item by its position, and count from zero.

    8 min
  5. 5

    Do This for Every Item

    Write a loop over a list and say what the body does on each pass.

    9 min
  6. 6

    Choosing

    Write a condition, read what it returns, and keep only the items you want.

    8 min
  7. 7

    Named Recipes

    Write a function, call it with different inputs, and hand a result back.

    9 min
  8. 8

    Reading an Error Without Fear

    Read the three parts of an error message and find the line that caused it.

    8 min
  9. 9

    A Grid of Numbers

    Read a shape out loud and reach any number in a grid by its address.

    10 min
  10. 10

    Math on Everything at Once

    Do arithmetic on a whole grid in one line and predict the shape that comes out.

    9 min
  11. 11

    Draw It Before You Trust It

    Draw a set of numbers and name something the summary hid.

    8 min
  12. 12

    One Small Experiment

    Load real numbers, check them, compute one thing, and draw the result.

    9 min
  13. 13

    Reading Other People's Code

    Work out what an unfamiliar snippet does without asking its author.

    9 min

Before you start

Nothing to learn first. You can start here.

Keep going

All chapters