Python
Start with readable code and build a foundation in problem solving.
Beginner
Your first Python program
Python follows a series of instructions and can print the result for you to see.
Variables and values
Give values names and follow what changes when you reassign a Python variable.
Numbers, operators, and conversion
Python uses integers for whole numbers and floating-point values for numbers with a fractional part.
Reading input and displaying results
Input lets a person provide a value while a Python program is running.
Strings, slices, and formatting
A string is text you can inspect, slice, and combine to make a message.
Decisions with if and else
Write Boolean conditions and follow which branch of a Python program runs.
Loops and counters
Follow a Python loop one iteration at a time and see when the counter stops.
Lists, indexes, and copies
A list keeps values in order and can change as your program runs.
Tuples and sets
A tuple holds values in a fixed sequence, while a set keeps unique values.
Lists and dictionaries
Choose between position-based access and lookup by key.
Functions and return values
Give a repeatable operation a name, pass arguments to it, and use its result.
Intermediate
Errors and input validation
Handle a predictable bad input and trace unexpected Python errors.
List and dictionary comprehensions
A comprehension builds a new collection by describing what to produce from each item.
Modules, imports, and packages
A module is a file of Python code that other files can import.
Files and JSON
A file preserves data between program runs, and JSON gives lists and objects a portable text format.
Classes, instances, and dataclasses
A class gives related data and behavior a shared structure.
Type hints and data contracts
Type hints describe the values a function expects and produces.
Virtual environments and dependencies
A virtual environment gives a Python project its own package installation.
Positional and keyword arguments
Python binds each argument you pass to a parameter in the function definition.
Advanced
Iterators and generators
An iterator hands you one value at a time, and a generator is a function that makes an iterator using yield.
Decorators and function wrapping
A decorator accepts a function and returns the function or a replacement with added behavior.
Context managers and resource cleanup
A context manager defines what happens when entering and leaving a block.
Async tasks and cancellation
Async code lets one task yield while it waits so another task can make progress.
Profiling and memory use
Profiling measures where a program spends time so you can work on its biggest cost first.