Python
A free, complete Python course from beginner to advanced: basics, data structures, OOP, files, testing, APIs and projects, with exercises.
Module 1 · Beginner
Getting started
What Python is, how to install it, how to run code, your first program, and how to read error messages.
Module 2 · Beginner
Python basics
Variables, numbers, strings, formatted output, user input and readable code: the building blocks of every program.
Module 3 · Beginner
Conditions and loops
Make decisions and repeat work: if statements, loops and pattern matching.
Module 4 · Beginner
Lists, dictionaries, sets and tuples
Python's four built-in collections, and how to choose the right one.
- Python lists tutorial, with examples
- Python dictionary tutorial, with examples
- Python tuples and unpacking, with examples
- Python sets and set operations, with examples
- Python list, dict and set comprehensions
- Nested lists, dictionaries and JSON in Python
- List, tuple, set or dictionary? How to choose
Module 5 · Beginner
Working with text
Slice, search, clean and format text, and match patterns with regular expressions.
Module 6 · Beginner
Functions and modules
Organise code into reusable functions and modules, and use code other people have written.
Module 7 · Beginner
Files and error handling
Save and load data, and keep programs running when something goes wrong.
Module 8 · Intermediate
Object-oriented Python
Model real things with classes and objects, the style frameworks like Django are built on.
- Python classes and objects for beginners
- The __init__ method and instance attributes
- Inheritance and super()
- Encapsulation, properties and private attributes
- Class methods and static methods
- Magic (dunder) methods: __str__, __len__ and more
- Dataclasses: classes without boilerplate
Module 9 · Intermediate
The standard library
The modules that ship with Python, so you rarely start from scratch.
- Dates and times with datetime
- collections: Counter, defaultdict and deque
- math, random and statistics
- os, sys and shutil: talking to your computer
- Command-line programs with argparse
Module 10 · Intermediate
Automate the boring stuff
Let Python do repetitive work for you: files, spreadsheets, emails and browsers.
- Rename and organise files automatically
- Automate Excel with openpyxl
- Send emails with Python
- Browser automation with Playwright
- Schedule Python scripts to run automatically
Module 11 · Intermediate
Testing and debugging
Find bugs faster and prove your code works.
- Debugging Python with breakpoints in VS Code
- assert and writing your first tests
- Testing with pytest
- Clean code: PEP 8, linters and formatters
Module 12 · Intermediate
Python and the web
Talk to websites and APIs, and build your own.
- How HTTP works: requests and responses
- Calling REST APIs with requests
- Web scraping with Beautiful Soup
- Build your first API with Flask
- FastAPI for beginners
- Django for beginners: build a blog
Module 13 · Intermediate
Python and databases
Store data properly, with SQL and Python.
- SQL basics for Python developers
- SQLite with the sqlite3 module
- Using an ORM: SQLAlchemy basics
- MongoDB with PyMongo
Module 14 · Advanced
Advanced Python
The features that separate beginner code from professional Python.
- Python iterators and iterables explained
- Python generators and yield, with examples
- Python itertools module, with examples
- Python functools: partial, reduce, lru_cache
- Decorators explained, with examples
- Context managers and the with statement
- Closures and first-class functions
- Mutability, references and copying objects
Module 15 · Advanced
Concurrency and performance
Do several things at once, and make slow code faster.
- The GIL explained
- Threads with threading and concurrent.futures
- Multiprocessing for CPU-heavy work
- asyncio basics: async and await
- Profiling and speeding up Python code
Module 16 · Intermediate
Python for data
The libraries behind data analysis and machine learning.
Module 17 · Intermediate
Projects
Build real programs that pull everything together, and put them on GitHub.
- Number guessing game
- To-do list app for the command line
- Contact book that saves to JSON
- Expense tracker with CSV reports
- Weather app using a public API
- Quiz game with classes
- Web scraper that saves results to a spreadsheet
- Put your projects on GitHub: a portfolio guide
Module 18 · Advanced
Python interview preparation
Get ready for Python questions and coding rounds.
- 50 Python interview questions with answers
- Python coding problems for interviews
- Big-O notation in Python, with examples
- Python output-prediction questions
Want to learn this with others?
Join our free Python training, run by the theprogrammers community.