Python Programming
Learn Python from your very first line to object-oriented programming, one small topic at a time. Every example runs in your browser, so you can change it and see what happens.
- 10 modules
- 64 lessons
- 353 runnable examples
- Beginner to advanced
Getting started
What Python is, your first program, and how Python reads your code.
Strings
Working with text: slicing, methods and formatting.
Decisions
Operators, booleans, and making your program choose.
Loops
Repeating work without repeating code.
Collections
Lists, tuples, sets and dictionaries.
Functions
Packaging code into reusable pieces.
Errors and files
Handling what goes wrong, and keeping data in files.
Modules and the standard library
Using code that already exists.
Object-oriented Python
Modelling things with classes.
Going further
The features that make Python code Pythonic.
Python quiz
Ten questions drawn at random from 180, with an explanation after every answer. Score 70% to pass; a perfect round earns a badge.
- Treasure Quest
Sail across eight islands. Each one asks a question; lose three hearts and it's back to port.
- Speed Run
Sixty seconds on the clock. Every right answer scores, and a wrong one costs five seconds.
- Code Puzzle
Real code from the lessons, shuffled line by line. Put it back in the right order.