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.
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.
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.
Operators and Expressions
Arithmetic, comparison, logic and precedence
Master arithmetic, comparison, logical and assignment operators, operator precedence, and how Python evaluates truthiness.
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.
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.
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.
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.
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.
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.
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.