Index Ai Academy
Phase 0 · ToolsPython core

Typing code exactly

About 26 minLooking ahead: some prerequisites aren't done yet

Why this matters

A person reading your note forgives a missing bracket. Python doesn't: it reads characters, not intentions. In a first week of coding, most of what goes wrong is typing, not thinking: a bracket left open, a quote pasted from a document, a capital letter, a few stray spaces. Learning to see those takes about twenty minutes and saves hours. The habit carries on into AI work, where a prompt, a settings file and a model's reply are all exact text too.

  • Find and type the characters code is built from: three kinds of brackets, two quotes, the colon, the underscore and the hash
  • Close every bracket and quote you open, and find the one that was left open
  • Start each line where it belongs: at the left edge, or four spaces in
  • Spot the look-alikes that stop a program: curly quotes, a capital letter, l for 1 and O for 0
Quick check
A guess before you start. Python runs one of these lines and refuses the other three. Which one runs?

The idea: Python reads one character at a time

This lesson rests on Your first program: Python runs the text you typed, and it stops at the first character it can't read.