Python, the way it really works
Fourteen short lessons with real Python running in the page. Beginner teaches the syntax, gently. Advanced shows how Python really works underneath, and you see every idea run for yourself. Nothing to install, and your code never leaves your browser.
Key facts
- 14 lessons of 5 to 9 minutes, about 1 h 44 min in all.
Your progress
0 of 14 lessons
Know some already? Jump to Advanced.
The lessons
Beginner 8 lessons · 52 min
Python from the first line: printing, names and types, text, numbers, lists, dictionaries, loops and functions. No experience needed.
First steps
Collections and control
- Lesson 5: Lists: index, append, slice and in6 min
[a, b]xs[0].append()xs[1:3] - Lesson 6: Dictionaries: keys, values and .get()6 min
{key: value}d[key].get().items() - Lesson 7: Decisions and loops: if, for, range and while8 min
if / elif / elseforrange()while - Lesson 8: Functions: parameters, return and defaults7 min
defreturnparam=defaultdocstring
Advanced 6 lessons · 52 min
How Python really works: objects and names, the special methods behind len() and for, iteration, hashing and dataclasses. Each idea runs in the editor, so you see it for yourself.
You should know variables and types, lists and dicts, if and for, and how to write a function. Each Beginner lesson covers one of these if you need a refresher.
Objects and names
The data model
- Lesson 11: Speaking Python: special methods9 min
__init____repr____len____getitem__ - Lesson 12: Iteration: iter, next and lazy generators9 min
iter()next()StopIteration__iter__ / __next__ - Lesson 13: Hashing and mutability: why lists can’t be dict keys9 min
hash()hashabletuple__eq__ - Lesson 14: Dataclasses: less boilerplate, same data model8 min
@dataclassfield(default_factory=…)frozen=Trueorder=True
Practice Python
No task, no checks: a Python editor to try anything in. Write some code and press Run.
Free practice. Write any Python and press Run.
Starting…
Frequently Asked Questions
Do I need to install Python to do these lessons?
No. Each lesson has a Python editor that runs real Python in your browser, on any computer, tablet or phone. It is CPython, the standard Python, compiled to WebAssembly by the Pyodide project. Your code runs on your own device and is never sent anywhere.
Which version of Python do the lessons use?
Python 3.14. Everything in the lessons works the same in Python 3.14 on your own computer, and almost all of it in older Python 3 versions too. Where an older version behaves differently in a way you might notice, the lesson says so.
Can I skip straight to the Advanced lessons?
Yes. The Advanced lessons assume you can already use variables, lists, dictionaries, if and for, and write a function. If you can, start with lesson 9. If any of those feel shaky, the Beginner lesson on it takes five to eight minutes.
How long does the course take?
The 14 lessons take 5 to 9 minutes each, about an hour and three quarters in all, split roughly evenly between Beginner and Advanced. You can stop at any point: finished lessons are remembered in this browser.
What happens if my code runs for ever?
Press Stop. Python runs separately from the page, so an endless loop can’t freeze it, and a run that takes too long is stopped for you with a message saying so.
Where is my progress saved?
In this browser only, like everything else on the site. It is included when you back up your data at /backup, and syncs to your other devices if you have set up sync. The code you write is never saved or sent anywhere.