Skip to content

learn

The path

Each track is a couple of short lessons — predict, read, run, change — and after each, exercises you write yourself. Take them in order if you are new; skip freely if you are not.

1 · The basics

  1. First programs

    Print something. Read something. Run it and see.

  2. Names and values

    A name holds a value; arithmetic makes new ones.

  3. Decisions

    if, elif, else — and exactly one branch runs.

  4. Loops

    Do it again: for over a range, while until something is true.

  5. Functions

    Name a piece of work, give it inputs, get a value back.

  6. Lists

    Many values under one name, and the difference between a new list and a changed one.

    1. 1Lists12 min
  7. Strings

    Text is a sequence too: index it, loop over it, build new ones.

  8. Dictionaries

    Look things up by name instead of by position.

2 · Data structures and algorithms

  1. Counting steps

    Two right answers can differ by a factor of a thousand. Measure it.

  2. Searching

    Look at everything, or halve the problem each time.

  3. Sorting

    Put things in order yourself, once, to know what sorted() is doing.

    1. 1Sorting12 min
  4. Stacks and queues

    Last in, first out; first in, first out.

  5. Hash maps and sets

    Trade memory for time: remember what you have seen.

  6. Recursion

    A function that calls itself on a smaller problem, and a base case that stops it.

  7. Linked lists

    Nodes that point at the next node. Relink them without losing any.

  8. Trees

    Nodes with two children, and the recursion that walks them.

    1. 1Trees10 min
  9. Graphs

    Neighbours, visited sets, and breadth-first search.

    1. 1Graphs12 min
  10. Dynamic programming

    Solve each small problem once and keep the answer.