Python
Master Python the way professionals use it today: clean syntax, modern type hints, asyncio for high-throughput LLM apps, Pydantic for safe data, FastAPI for serving, and the engineering practices that ship.
- Chapter 01
Core Language
12 lessons - 01 Getting Started Read the smallest useful Python program line by line, then set the language up the way professionals actually do — uv, virtual environments, and th…
- 02 Syntax & Style In Python, indentation is not decoration — it is the syntax. Learn the rules, the conventions every team enforces, and the tools that end formattin…
- 03 Variables & Types Python is dynamically typed, yet types still rule everything. Learn what a variable really is — a name, not a box — the core built-in types, and ho…
- 04 Numbers int, float, Decimal, Fraction — and the floating-point quirk that has quietly cost real companies real money.
- 05 Strings Python strings — the methods you will actually use, slicing with negative indices, and the f-string tricks that make code read like prose.
- 06 Lists Python's workhorse collection — append, slice, sort, and the shared-reference gotcha that bites every programmer exactly once.
- 07 Tuples Immutable sequences with hidden superpowers — unpacking, named tuples, and the right tool whenever the answer is 'this should never change.'
- 08 Sets Unordered, unique, and blazingly fast for membership tests — the right tool whenever you would otherwise track what you have already seen.
- 09 Dictionaries Python's most useful data structure — key-value lookups, the .get pattern, and the collections helpers that turn hard problems into one-liners.
- 10 Control Flow if/elif/else, modern match/case, loops, the walrus operator, and the for/else clause that almost nobody knows about.
- 11 Functions Args, kwargs, defaults, keyword-only, type hints — and the mutable-default bug that has made it onto every interview-questions list.
- 12 Comprehensions The Pythonic way to build a list, dict, set, or generator from another iterable — and the honest line between when they help readability and when t…
- Chapter 02
Pythonic Mid-Level
12 lessons - 13 Iterators The protocol behind every for-loop in Python — build your own iterators, tell an iterable from an iterator, and stop loading whole datasets into me…
- 14 Generators Lazy iterators in three lines — stream large files, build pipeline stages, and stop blowing up your RAM.
- 15 Decorators Wrap any function with logging, retry, caching, or auth — without touching its code. The @ syntax, demystified.
- 16 Context Managers The with statement, why open() is the gold standard, and how to write your own context managers for transactions, temp dirs, and guaranteed teardown.
- 17 Errors & Exceptions try/except done right — catch specific errors, chain context, raise custom types, and know when NOT to use exceptions at all.
- 18 Modules & Packages How Python finds your code, the src/ layout professionals use, the __main__ idiom, and the path from one .py file to an installable package.
- 19 Environments & packaging: venv, uv, pex Where your packages actually install, why uv is 10-100x faster than pip, and how to ship a Python app as one file.
- 20 File I/O open() with the right mode, the with-statement that closes files for you, and streaming big files without melting your laptop.
- 21 pathlib The modern, object-oriented path API — forget os.path.join, use the / operator and real methods, and stop debugging slashes on Windows.
- 22 Regex The re module essentials — search vs findall, named groups, and the patterns you'll actually use to parse log lines and clean data.
- 23 datetime & timezones datetime, timedelta, and zoneinfo — the right way to handle dates so you stop shipping bugs at midnight UTC.
- 24 Logging Why print() stops being acceptable the moment your code runs in production — the logging module, structured logs, and config you can ship.
- Chapter 03
OOP & Modern Python
5 lessons - 25 Classes & Instances class syntax, __init__, methods, properties — the building blocks of object-oriented Python, without the over-engineering.
- 26 Inheritance vs Composition class Child(Parent), super(), abstract base classes — and the 'composition over inheritance' rule that keeps codebases sane.
- 27 Dunder Methods __repr__, __eq__, __hash__, __len__, __iter__, __call__ — the special methods that make your classes behave like Python's built-ins.
- 28 dataclasses @dataclass writes __init__, __repr__, and __eq__ for you. The right tool for internal data containers — and when to reach for Pydantic instead.
- 29 Type Hints Deep Dive Catch bugs before runtime, get real autocomplete, and write docs that don't rot — the pragmatic guide to typing Python today.
- Chapter 04
Concurrency & Async
5 lessons - 30 The GIL Why a Python process runs one bytecode instruction at a time, when that hurts you, and when it doesn't.
- 31 Threading ThreadPoolExecutor — the modern, sane way to do I/O-bound concurrency in Python.
- 32 Multiprocessing Bypass the GIL with real OS processes — when your code is CPU-bound and you want all your cores.
- 33 Asyncio async / await, the event loop, and the small set of primitives that handle thousands of concurrent I/O operations on a single thread.
- 34 Async patterns for LLM apps Fan-out, streaming, rate-limit-aware concurrency, and cancellation — the async primitives every LLM-backed service needs.
- Chapter 05
Data Validation & APIs
3 lessons - 35 Pydantic v2 Type hints validate nothing at runtime. Pydantic does — and it is now the de-facto data layer for FastAPI, LLM outputs, and config in modern Python.
- 36 Pydantic for LLM outputs The killer use case today — define a Pydantic model, hand its JSON schema to an LLM, and get back typed Python objects. No regex, no broken JSON pa…
- 37 FastAPI Type hints define your API. FastAPI turns a Python function into a validated, documented HTTP endpoint with one decorator — now the default for new…
- Chapter 06
Python for LLM Apps
4 lessons - 38 Tokenization Tokens — not words or characters — are the unit of everything in LLM-land: pricing, context windows, truncation. Here is how they work and how to c…
- 39 OpenAI & Anthropic SDKs The modern way to call frontier models from Python — the Responses API for OpenAI, the Messages API for Anthropic, side by side with the patterns y…
- 40 Streaming responses Why streaming halves perceived latency, how server-sent events work under the SDK, and the Python patterns for consuming, aggregating, and cancelli…
- 41 Embeddings A vector that captures the meaning of text — the building block behind semantic search, recommendations, dedup, and RAG. Cosine similarity, modern…
- End of section 0 / 41 complete
Make it stick — pass every quiz.
Each lesson has a short quiz at the bottom. Passing the quiz is what marks the lesson complete and counts toward your certificate.
Python — frequently asked questions
Straight answers to the questions people ask most about python.
Do I need to know math to start learning Python?
No. Python's core syntax — variables, loops, functions, lists, and dictionaries — needs nothing beyond basic arithmetic. Math only matters later for specific domains like data science, and even then the Python itself stays simple. Start with the syntax and add math when a project demands it.
What's the difference between a list and a tuple in Python?
A list is mutable (you can add, remove, or change items) and uses square brackets; a tuple is immutable (fixed once created) and uses parentheses. Use a list when the collection will change, and a tuple for fixed records or as dictionary keys, where immutability is required.
Why is my Python code slow — is the GIL to blame?
For CPU-bound work, the Global Interpreter Lock (GIL) stops threads from running Python bytecode in true parallel, so threading won't help — use multiprocessing or vectorised libraries like NumPy. For I/O-bound work the GIL is released during waits, so threads or asyncio do help. Most 'slow Python' is actually unvectorised or algorithmic, not the GIL.
Read the lessonWhen should I use a list comprehension instead of a for loop?
Use a comprehension when you're building a new list by transforming or filtering an iterable — it's more concise and usually faster. Stick with a regular for loop when the body has side effects, multiple statements, or complex logic, where a comprehension would hurt readability.
What's the difference between == and is in Python?
`==` checks whether two values are equal; `is` checks whether two names point to the exact same object in memory. Use `==` for value comparison (the common case) and reserve `is` for identity checks like `x is None`.