0coins

New here? Start with this 30-second guide

Programming means giving a computer a list of instructions, one line at a time. Python is a popular language for writing them. Every program has to remember things (numbers, words) while it runs, and that remembering happens in the computer’s memory.

You cannot normally see memory. This app lets you watch it. For each lesson: 1. read “In plain words”, 2. look at the next line and predict what will happen, 3. press Next line and check yourself. Win each lesson’s challenge to earn coins, then spend coins to unlock the next lesson. No typing needed, and you cannot break anything.

Already code for a living? Open “Going deeper” under each lesson for how really behaves.

In plain words

Going deeper (for experienced programmers)

    Tip: press the right arrow key to run the next line.

      Console

      What is CPython?

      CPython is the actual program that runs when you type python on your own computer. It is the original, most widely used implementation of the Python language, written mostly in the C programming language. This app does not run CPython itself — it uses a small JavaScript model built to mirror the same ideas, so you can watch them without installing anything.

      What happens when CPython runs a line of code

      1. Parse. Your source code is read and checked for valid syntax, then turned into a tree that represents its structure.
      2. Compile to bytecode. That tree is compiled into a simpler, lower-level set of instructions called bytecode — not machine code, but a format CPython's own engine understands.
      3. Execute in a loop. A loop inside CPython, its evaluation loop, reads one bytecode instruction at a time and carries it out, from top to bottom — the same one-line-at-a-time idea this app visualizes.
      4. Manage objects. Every value — a number, a string, anything — is an object on the heap. CPython keeps a reference count on each one and frees it the moment nothing points to it any more, exactly like the refs you see in the memory picture above.

      Other implementations of Python exist — PyPy, Jython, IronPython — but when people say “Python”, they almost always mean CPython.

      Read more in the official Python FAQ →