May we set cookies? Ours tells a returning reader from a new one; Google's and TikTok's tell them whether an advertisement brought you here and what it led to. Say no and the site is exactly the same, and nothing that identifies your browser is kept or shared. What we measure

howdoistudy

Learn Python by watching your code run

Trace · a Python loopRUNNING
1total = 0
2for n in [3, 1, 4, 1, 5]:
3 if n > total:
4 total = n
5print(total)
total0
nunset
Outputwaiting…

Start with nothing in the box.

Step 1 of 15

A Python loop traced line by line, with the variables changing beside it.

Plenty of beginners can read a loop and still not say what it does. Another explanation of loops won't fix that. Watching the variables change one line at a time will, until your picture of the code matches the machine's. The block below does that, and your lessons run on the same code.

What people come here to do

You describe the goal in your own words and the plan asks questions back until it is one you would follow. Goals usually look like these.

  • “Write scripts that automate something at work”
  • “Get through a data course that assumes Python I never learnt”
  • “Move from copying snippets to reading a stack trace”
  • “Prepare for a technical interview”

What a Python plan covers

There is no fixed syllabus. The plan is built around your goal and drops what it does not need. These are the topics it draws from.

  • Variables, types and how Python actually stores them
  • Loops, conditionals and control flow
  • Functions, scope and arguments
  • Lists, dicts, sets and when each is the right one
  • Reading errors and debugging your own code
  • Files, APIs and working with real data