Skip to content

Chapter 0 key points

Every key point of the chapter, generated from the episode front matter.

0.1 How this course works

  • Four Parts, sixteen chapters; episode 2.3 is the third episode of Chapter 2. Chapters 0–2 are available now; the rest are marked soon.
  • Read the Overview card first and the Key points card last; they are the contract for the page.
  • Predict boxes and checkpoints work only if you commit to an answer before looking.
  • Exercises are graded ★ (check), ★★ (apply), ★★★ (stretch). Do all the ★ ones, and at least one ★★ per episode.
  • The site keeps no record of what you have read. Only your theme choice is remembered, in this browser.

0.2 Setting up Python

  • Colab needs no install and is enough for all of Part I; a local environment is faster, private and works offline.
  • One project, one environment. Never install course libraries into the Python that came with your operating system.
  • Pinned versions are what the course was tested with; a slightly different version usually works, and check_env.py tells you when it does not.
  • The Python that runs a notebook is the kernel you selected, not the one on your command line; most ‘it works in the terminal but not in the notebook’ problems are a kernel mismatch.
  • When cells behave strangely, restart the kernel and run from the top before you look for a bug.

0.3 Python self-check

  • Python indexes from 0 and slices are half-open: xs[1:4] is items 1, 2 and 3, and range(n) stops at n − 1.
  • A function without return returns None; assigning a list to a second name does not copy it.
  • Read tracebacks from the last line upwards: the error first, then the nearest line of your own code.
  • Floats are binary approximations: never compare them with ==; use a tolerance such as math.isclose.
  • / always gives a float, // gives floor division and % the remainder; mixing them up silently changes results.
  • Seven or more out of ten right: start Chapter 1. Fewer: spend a week with one of the free refreshers and come back.