Python
Modern Python (3.14) from your very first program to tested, packaged, real-world software.
Free to read now, no account needed: Before you start: programs, files, and the terminal. Create a free account to open the other chapters, take the quizzes and keep your progress.
My setup
Lessons that differ by operating system or tool show your choice first, and fold away notes meant for other setups. You can switch tabs in any lesson β it remembers what you pick.
Operating system
Editor
1 Getting started with modern Python π
Create a free account to open this chapter.
- What Python is ~25 min
- Installing Python 3.14 ~35 min
- The interactive interpreter ~30 min
- Writing and running scripts ~30 min
- Editors, IDEs, and notebooks ~40 min
- Syntax, statements, and expressions ~35 min
- Variables, objects, and references ~40 min
- Input, output, and first errors ~45 min
2 Values, types, and operators π
Create a free account to open this chapter.
- Everything is an object ~35 min
- Integers and arithmetic ~40 min
- Floats and complex numbers ~45 min
- Booleans and None ~35 min
- Comparisons and boolean logic ~40 min
- Identity, equality, and membership ~35 min
- Precedence and conversion ~40 min
- The math, statistics, and random modules ~45 min
3 Strings and text processing π
Create a free account to open this chapter.
- String literals and escapes ~40 min
- Indexing, slicing, and immutability ~45 min
- String methods ~50 min
- Split, join, and parsing lines ~50 min
- Formatting with f-strings ~50 min
- Unicode, UTF-8, and bytes ~50 min
- Regular expressions ~60 min
- Text-processing patterns ~55 min
4 Decisions and repetition π
Create a free account to open this chapter.
- if, elif, and else ~45 min
- Conditional expressions and match ~45 min
- while loops ~45 min
- for loops and range ~45 min
- break, continue, pass, and loop else ~45 min
- Nested loops ~40 min
- Loop patterns ~45 min
- Solving problems with loops ~50 min
5 Collections π
Create a free account to open this chapter.
- Lists ~40 min
- Changing lists ~40 min
- Tuples and unpacking ~40 min
- Dictionaries ~45 min
- Sets ~40 min
- Nesting, mutability, and copying ~45 min
- Sorting and iteration tools ~45 min
- Comprehensions ~50 min
- The collections module and structural patterns ~50 min
6 Functions and program structure π
Create a free account to open this chapter.
- Defining and calling functions ~50 min
- Parameters and arguments ~50 min
- Scope and namespaces ~50 min
- Flexible signatures ~50 min
- Functions as values ~50 min
- Recursion ~50 min
- Designing functions ~60 min
7 Modules, packages, and project structure π
Create a free account to open this chapter.
- Modules and imports ~55 min
- __name__ and the main guard ~40 min
- Packages and relative imports ~50 min
- The standard library ~55 min
- Virtual environments ~50 min
- Installing packages ~50 min
- Projects with pyproject.toml and uv ~60 min
- Version control with git ~55 min
8 Files, paths, and data π
Create a free account to open this chapter.
- Paths with pathlib ~55 min
- Reading and writing text files ~55 min
- Binary files and encodings ~50 min
- Directories and file operations ~60 min
- CSV files ~55 min
- JSON and serialization ~55 min
- Configuration files and environment variables ~50 min
- Data-processing programs ~65 min
9 Exceptions, debugging, and testing π
Create a free account to open this chapter.
- Exceptions and tracebacks ~50 min
- try, except, else, and finally ~55 min
- Raising and custom exceptions ~55 min
- Exception design ~50 min
- Debugging ~60 min
- Logging ~50 min
- Unit testing with pytest ~60 min
- Fixtures, edge cases, and TDD ~65 min
10 Object-oriented Python π
Create a free account to open this chapter.
- Classes and instances ~55 min
- Class and instance attributes ~50 min
- Special methods ~60 min
- Encapsulation and properties ~55 min
- Inheritance and super() ~60 min
- Composition and polymorphism ~55 min
- Abstract base classes ~55 min
- Dataclasses and enums ~60 min
- Python's flexible object model ~55 min
11 Iterators, generators, decorators, and context managers π
Create a free account to open this chapter.
- Iterables and iterators ~50 min
- Generators and yield ~55 min
- Generator pipelines ~50 min
- itertools and functools ~55 min
- Closures ~50 min
- Decorators ~60 min
- Context managers ~60 min
- Descriptors and attribute access ~40 min
12 Type hints and modern tooling π
Create a free account to open this chapter.
- Why type hints? ~45 min
- Annotating variables and functions ~55 min
- Literal, TypedDict and type aliases ~50 min
- Protocols and generics ~60 min
- Type checkers: mypy and pyright ~55 min
- Annotations at runtime ~45 min
- Formatting, linting and a modern workflow ~60 min
13 Concurrency and asynchronous Python π
Create a free account to open this chapter.
- Sequential, concurrent, and parallel ~40 min
- Threads ~45 min
- Processes ~45 min
- concurrent.futures ~45 min
- Coroutines, async, and await ~45 min
- Tasks and TaskGroups ~50 min
- Async in practice ~50 min
14 Networking, APIs, and web data π
Create a free account to open this chapter.
- How the web works ~40 min
- Methods, status codes and headers ~40 min
- Calling APIs with requests and httpx ~50 min
- JSON APIs and REST ~45 min
- Authentication and secrets ~45 min
- HTML and the DOM ~40 min
- Responsible web scraping ~40 min
- Parsing HTML with Beautiful Soup ~45 min
15 Scientific, numerical, and data Python π
Create a free account to open this chapter.
- The Python ecosystem map ~35 min
- NumPy arrays ~40 min
- Vectorization and broadcasting ~45 min
- Indexing, views, and linear algebra ~50 min
- pandas Series and DataFrames ~50 min
- Filtering, grouping, and joining ~50 min
- Polars in brief ~35 min
- Visualization ~40 min
- Where Python leads next ~30 min
16 Databases, web applications, and automation π
Create a free account to open this chapter.
- SQL in one section ~50 min
- sqlite3 and the DB-API ~55 min
- SQLAlchemy ~55 min
- Web frameworks ~40 min
- A small FastAPI service ~60 min
- Flask in brief ~40 min
- Command-line programs ~50 min
- Automation scripts ~55 min
17 CPython and the Python ecosystem π
Create a free account to open this chapter.
- The language and its implementations ~35 min
- From source code to bytecode ~40 min
- The interpreter loop ~40 min
- Memory management ~40 min
- The GIL and free-threaded Python ~40 min
- C extensions ~35 min
- Other Python implementations ~40 min
18 Building and shipping Python applications π
Create a free account to open this chapter.
- Project architecture ~45 min
- Dependencies and lockfiles ~45 min
- Building and publishing distributions ~60 min
- Documentation ~40 min
- Continuous integration ~45 min
- Configuration, secrets and production logging ~50 min
- Security basics ~50 min
- Performance and profiling ~55 min
- Deployment ~55 min
19 Capstone π
Create a free account to open this chapter.
- Choosing a project ~35 min
- Planning and architecture ~45 min
- Option 1: a data analysis application ~40 min
- Option 2: an API and data application ~40 min
- Option 3: a web application ~40 min
- Option 4: an automation system ~40 min
- Engineering review ~40 min
Appendices
Reference chapters on the tools the course uses. Dip in when a lab or a section sends you here; they are not part of the course exam.
A Older code you may encounter π
Create a free account to open this chapter.
- Older Python, and its modern form ~45 min
B New in Python 3.15 π
Create a free account to open this chapter.
- What Python 3.15 adds ~40 min