Python from zero
Learn to program from zero with Python — short, readable code that runs as soon as you write it. The language of scripting, automation, data, and machine learning, and the easiest first language to read. The whole course is free.
1Getting Started
What a program is, how Python runs it, and your first lines of output.
2Variables & Types
Storing values — numbers, text, True/False, and None — and reading them from the user.
- VariablesNames that refer to values.
- Numbersint and float — whole numbers and decimals.
- StringsText in quotes — joining, repeating, and measuring it.
- Booleans and NoneTrue, False, truthiness, and the value that means "nothing".
- Type ConversionTurning text into numbers and numbers into text.
- Reading Inputinput(), and turning what the user typed into numbers.
3Operators
Maths, comparisons, and combining True/False answers.
4Strings
Getting at characters, transforming text, and formatting it beautifully.
5Control Flow
Making decisions and repeating work — if, loops, and match.
- if, elif, elseRunning code only when a condition is True.
- while LoopsRepeating while a condition stays True.
- for Loops and rangeGoing through items one at a time, and counting.
- break and continueLeaving a loop early, or skipping one round.
- match and casePicking a branch by matching a value against patterns.
6Collections
Holding many values at once — lists, tuples, sets, and dictionaries — and building them in one line.
7Functions
Naming a piece of work once and using it everywhere — parameters, return values, scope, lambdas, and recursion.
- Functionsdef, calling, and why functions exist.
- Parameters and returnPassing values in, getting results back, and default values.
- *args and **kwargsFunctions that take any number of arguments.
- ScopeLocal and global names, and where Python looks them up.
- LambdasTiny one-line functions, and sorting by a key.
- RecursionFunctions that call themselves.
8Errors
Reading tracebacks, catching exceptions, and raising your own.
9Files & Modules
Saving data to files, splitting code into modules, and a tour of the standard library.
10Classes & Objects
Bundling data with the code that uses it — classes, inheritance, dunder methods, and dataclasses.
11Pythonic Idioms
The habits that make Python code short and clear — enumerate, zip, unpacking, generators, and decorators.