PLAY FREE ▸
Snekcade › Python guides
FREE PYTHON GUIDES

Learn Python, one topic at a time

Short guides with real examples and a quick quiz. Read one in five minutes, then practise it in the game.

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 PLAINS

Print and variables

print(), variables, numbers vs text, math and f-strings.

PRINT PLAINS

Strings and string methods

Indexing, slicing, split/join, strip, replace and f-strings.

PRINT PLAINS

User input

input(), converting to numbers, handling bad answers and a guessing game.

LOOP LAGOON

If, elif and else

Make decisions: comparisons, and/or/not, elif chains and the classic = vs == trap.

LOOP LAGOON

Booleans and truthiness

True and False, and/or/not, truthy vs falsy, and why bool("False") is True.

LOOP LAGOON

For loops

Loop over lists, strings and range(), add things up, and avoid the classic off-by-one.

LOOP LAGOON

While loops

Repeat until a condition changes, while True with break, and infinite loops.

LOOP LAGOON

Lists

Indexes from 0, append and remove, slices, max/min/sum and IndexError.

LOOP LAGOON

List methods

append vs extend, pop vs remove, sort vs sorted, and why x.sort() gives None.

LOOP LAGOON

List comprehensions

Loop to one line, filters, if/else inside and dict comprehensions.

LOOP LAGOON

FizzBuzz

The classic challenge: % operator, check order and two solutions.

FUNCTION FOREST

Functions

def, parameters, return vs print, default values and scope.

FUNCTION FOREST

Random numbers

randint, choice, shuffle, chance with random() and seed.

DICT DUNGEON

Dictionaries

Keys and values, get(), items() and counting things.

DICT DUNGEON

Tuples and sets

Unpacking, swapping, unique items, set maths and list vs tuple vs set.

BUG BAY

Errors and try/except

Read error messages, the common error types, try/except/else/finally.

FILE FORTRESS

Reading and writing files

with open(), "w" vs "a", reading lines and saving data with json.

CLASS CASTLE

Classes and objects

__init__, self, methods and simple inheritance with heroes and monsters.

SNEK FINALE

Nested loops

A loop inside a loop: grids, lists of lists, every pair and breaking out.

SNEK FINALE

Snake game logic

Lists of positions, moving, growing and crash checks, step by step.

PRINT PLAINS

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