Learn how to code

Python from zero — the complete basics in 10 lessons

Every banner opens a full lesson on its own page. Work through them in order and finish with the final test covering the content of all ten articles.

1

Getting Started with Python

What Python is, how it runs, and your first program

Learn what Python is, why it is the most popular beginner language, how the interpreter works and how to write and run your very first program.

8 min read
2

Variables and Data Types

Storing values, naming things and Python's core types

Understand assignment, dynamic typing, the int, float, str and bool types, type conversion, and how to name variables well.

9 min read
3

Operators and Expressions

Arithmetic, comparison, logic and precedence

Master arithmetic, comparison, logical and assignment operators, operator precedence, and how Python evaluates truthiness.

8 min read
4

Control Flow: if, elif, else

Making decisions and the meaning of indentation

Learn conditional branching with if/elif/else, nested conditions, the conditional expression, and why indentation defines blocks in Python.

8 min read
5

Loops: for and while

Repeating work without repeating yourself

Iterate with for and range(), repeat with while, and control loops using break, continue and else clauses.

9 min read
6

Lists, Tuples, Sets and Dictionaries

Python's four essential collections

Store many values at once: mutable lists, immutable tuples, unique sets and key-value dictionaries — with slicing and comprehensions.

11 min read
7

Functions and Scope

Reusable blocks, parameters, return values and namespaces

Define your own functions, use positional, keyword and default arguments, return values, and understand local vs global scope.

10 min read
8

Strings, Input and Files

Working with text and talking to the outside world

Manipulate strings with slicing and methods, format output with f-strings, read user input and read/write files safely.

10 min read
9

Errors, Exceptions and Debugging

Reading tracebacks and writing code that fails gracefully

Tell syntax errors from exceptions, handle failures with try/except/else/finally, raise your own errors and debug systematically.

9 min read
10

Modules, Classes and Next Steps

Structuring bigger programs and where to go from here

Import from the standard library, write your own modules, take a first look at classes and objects, and plan your path beyond the basics.

11 min read
Final test — 30 questions on all ten lessonsStart the test →