1/13
Part 1 of 4 · Five movesLearn

A blank editor, and the first five minutes

Every coding round starts the same way: a short question, a few examples, and an empty editor. Here is one, the way a screen gives it:

Write first_repeat(ids): the first order ID that appears a second time in the list, or None if no ID does.

CallReturns
first_repeat([7, 3, 9, 3, 7])3
first_repeat([1, 2, 3])None

Most people freeze here because they try to write the final answer first. Strong candidates don't. They make five moves, in the same order every time, and the code follows from them:

  1. Say it back, with an example of your own.
  2. Write the examples as checks, so you can run them at any moment.
  3. Write the plainest version that's correct, however slow.
  4. Run it, read what fails, and fix it.
  5. Make it faster, only if the input needs it, and say what it costs.

This lesson makes those moves on four small questions, with less help each time, so that by the last one the editor holds nothing but a signature. 9 steps end with a small task in the editor. None of it is advanced Python: the point is the habit. Every lesson after this one starts with a question like first_repeat, and the first five minutes go the same way.