Learn Python, for free.
Short lessons you can run right here in your browser. Write real code in the first two minutes, get instant feedback, and build up one small step at a time. No sign-up and nothing to install.
Start with lesson 1I already code in another languageAlready know some Python? Take the placement test
How each lesson works
- Read a short explanation with an example.
- Try it: edit and run code in the built-in editor.
- Check your answer. Clear hints help when you are stuck.
Not sure where to start? The placement test takes about five minutes and suggests the right lesson. If you already program in another language, the fast track skips the basics and shows what is different in Python.
The course
72 lessons in 11 modules, about 21 hours in total. Plus 16 lessons in optional tracks, below.
Module 1 Foundations
Write and run your first programs: printing, values, variables and doing math with them.
- Hello, World!10 min
- Variables12 min
- Reading Error Messages12 min
- Values and Types12 min
- Asking for Input and Converting Types15 min
- Arithmetic and Operators15 min
- Working with Text (Strings)15 min
- f-strings: Building Text from Values12 min
- Booleans and Comparisons15 min
Module 2 Control Flow
Make your programs decide things and repeat things.
Module 3 Data Structures
Hold many values at once: lists, slices, sorting, tuples, dictionaries, sets and comprehensions.
Module 4 Functions
Package code into reusable, named pieces: parameters, return values, scope, recursion and a quiz-engine project.
Module 5 Text and Files
Work with text like a pro, then read and write files, CSV and JSON, and find patterns with regular expressions.
Module 6 Errors and Debugging
Handle failures gracefully with try/except, raise your own errors, hunt bugs methodically, log what happens, and finish with an expense-tracker project.
Module 7 Modules and Tooling
Use Python's standard library with confidence, install packages safely, and organise a project so it can grow.
- Importing Modules15 min
- The collections Module18 min
- Dates and Times18 min
- itertools and random18 min
- Packages, pip and Virtual Environmentsown computer20 min
- Organising a Python Project20 min
Module 8 Object-Oriented Programming
Bundle data and behaviour into classes, then use dunder methods, inheritance, composition, dataclasses, properties and abstract classes to design programs that grow.
Module 9 Pythonic Python
Write code the way experienced Python programmers do: iterators and generators, comprehension patterns, decorators, functools, type hints and a first look at async.
- Iterators and Iterables: How for Loops Really Work15 min
- Generators: Producing Values One at a Time18 min
- Comprehension Patterns and Generator Expressions16 min
- Decorators: Wrapping Functions20 min
- functools: Caching, Partial Functions and Reduce15 min
- Type Hints: Describing Your Data18 min
- async and await: Doing Waiting Work Togetherown computer20 min
Module 10 Testing and Quality
Prove that your code works with pytest, keep it readable and consistent, track it with Git, and package it so other people can install it. Ends with a capstone project.
- Testing with pytest: Writing Good Tests20 min
- Fixtures and Parametrize: Tests Without Repetitionown computer20 min
- Readable Code: Style, Formatters and Linters18 min
- Git Basics: Saving the History of Your Workown computer20 min
- Packaging: pyproject.toml and the src Layout20 min
- Project: Build, Test and Package a Mini Libraryown computer35 min
Optional tracks
Finished the basics (or at least Module 6)? These tracks apply Python to real jobs. They are never required. Lessons marked "own computer" need the local track: they must be run on your own computer, not in the browser.
Data Analysis
Use NumPy and pandas to load, clean, summarise and chart data: the everyday toolkit of data work. Runs in your browser (charts need your own computer).
- NumPy Arrays: Maths on Whole Lists at Once20 min
- pandas: Tables of Data with DataFrames22 min
- Selecting and Filtering Rows22 min
- Grouping and Summarising22 min
- Cleaning Messy Data24 min
- Project: Analyse a Sales Dataset35 min
- Charts with Matplotlibown computer22 min
Automation and Scripting
Write small tools that save you time: command-line programs, file and folder jobs, other programs, retries and schedules.
- Command-Line Programs with argparse22 min
- Working with Files and Folders in Bulk24 min
- Running Other Programs with subprocessown computer22 min
- Timing, Retrying and Scheduling24 min
- Project: A File Organiser35 min
Web and APIs
Understand how the web talks (HTTP), read data from JSON APIs, call web services, and build a small API of your own. Standard library only.
- How the Web Talks: URLs, Requests and Status Codes20 min
- Working with JSON APIs24 min
- Calling a Web Service with urllibown computer24 min
- Project: Build a Tiny JSON APIown computer40 min
Use it offline
Download Python once (about 15 MB) and the course works without a connection. You can also install it as an app from your browser's menu.
Your progress
Progress is saved only in this browser. Download a backup file to move to another device or keep it safe.