New to programming? Start at the top and go down: each guide builds on the one before. Every example has been run, and the output shown is exactly what Python prints.
Print and variables
print(), variables, numbers vs text, math and f-strings.
Strings and string methods
Indexing, slicing, split/join, strip, replace and f-strings.
User input
input(), converting to numbers, handling bad answers and a guessing game.
If, elif and else
Make decisions: comparisons, and/or/not, elif chains and the classic = vs == trap.
Booleans and truthiness
True and False, and/or/not, truthy vs falsy, and why bool("False") is True.
For loops
Loop over lists, strings and range(), add things up, and avoid the classic off-by-one.
While loops
Repeat until a condition changes, while True with break, and infinite loops.
Lists
Indexes from 0, append and remove, slices, max/min/sum and IndexError.
List methods
append vs extend, pop vs remove, sort vs sorted, and why x.sort() gives None.
List comprehensions
Loop to one line, filters, if/else inside and dict comprehensions.
FizzBuzz
The classic challenge: % operator, check order and two solutions.
Functions
def, parameters, return vs print, default values and scope.
Random numbers
randint, choice, shuffle, chance with random() and seed.
Dictionaries
Keys and values, get(), items() and counting things.
Tuples and sets
Unpacking, swapping, unique items, set maths and list vs tuple vs set.
Errors and try/except
Read error messages, the common error types, try/except/else/finally.
Reading and writing files
with open(), "w" vs "a", reading lines and saving data with json.
Classes and objects
__init__, self, methods and simple inheritance with heroes and monsters.
Nested loops
A loop inside a loop: grids, lists of lists, every pair and breaking out.
Snake game logic
Lists of positions, moving, growing and crash checks, step by step.
10 beginner exercises
10 practice problems with solutions, from hello to level-up math.
LEARN BY PLAYING
Every guide matches a world in Snekcade: short lessons, real Python that runs on your phone, and an explanation for every answer. The first two worlds are free, no account needed.
START PLAYING ▸ ▶ GET IT ON GOOGLE PLAY