Coding Python
79 coding games

More Python coding games

Robo Chef: Python coding game about what is a program?Sky Writer: Python coding game about meet python and print()Track Repair: Python coding game about reading error messagesMarket Stall: Python coding game about numbers and mathsTicket Booth: Python coding game about asking the user: input()Balance Scale: Python coding game about true, false and comparisonsTheme Park Rides: Python coding game about decisions inside decisionsBucket Brigade: Python coding game about while loopsRocket Countdown: Python coding game about counting by steps and backwardsFishing Contest: Python coding game about finding the biggest and searchingDance Floor: Python coding game about your first function: def and callingPizza Oven: Python coding game about parameters: giving a function informationCalculator: Python coding game about project: calculatorTrain Yard: Python coding game about listsDelivery Bike: Python coding game about looping over listsCode Breaker: Python coding game about text as a sequenceWord Guess: Python coding game about project: word guessSports Day: Python coding game about importing modules: randomPet Shelter: Python coding game about classes and objectsRobot Family: Python coding game about inheritance
Free · No sign-up · Plays in your browser

Python Coding Games

34 free Python coding games that you play by writing real Python, not by watching someone else write it. Seventeen of them take a single topic — variables, operators, strings, conditions, loops, lists, dictionaries, comprehensions, functions, recursion, exceptions, files, the standard library, classes, inheritance, generators and algorithms — and drill it until it sticks, and one is a new puzzle every day. The other six throw everything at you at once: a robot maze, a timed output quiz, bug hunts, turtle drawings, scrambled programs and code golf. Ten more are illustrated adventures — a quest, a space shooter, a farm, a treasure hunt, a rocket and more — where a character acts out every line you write. Everything runs in your browser — nothing to install, no account, and your code never leaves your device.

Level select

Learn one concept at a time

Each of these games covers a single Python topic in six short levels, and pairs with the tutorial on the same subject. Start here if you are still learning the language.

🗄️
Variables & data types

Variable Vault

Store the right value in the right type

6 levels · plays alongside the variables & data types tutorial
🎰
Numbers & operators

Operator Arcade

Hit the target number exactly

6 levels · plays alongside the numbers & operators tutorial
✂️
Strings & slicing

String Surgeon

Cut the text to exactly the right piece

6 levels · plays alongside the strings & slicing tutorial
🚦
if, elif and else

Gatekeeper

Write the rule that lets exactly the right ones through

6 levels · plays alongside the if, elif and else tutorial
🏭
for, while, break and continue

Loop Factory

Make the conveyor produce exactly these lines

6 levels · plays alongside the for, while, break and continue tutorial
📦
Lists

Crate Stack

Rearrange the crates with list operations

6 levels · plays alongside the lists tutorial
🗂️
Dictionaries & sets

Dict Detective

Work the case with keys, values and sets

6 levels · plays alongside the dictionaries & sets tutorial
🗜️
Comprehensions

Compressor

Squeeze the loop into one line

6 levels · plays alongside the comprehensions tutorial
⚙️
Functions

Function Forge

Build the machine to the spec

6 levels · plays alongside the functions tutorial
🗼
Recursion

Recursion Tower

Watch the calls stack up and unwind

6 levels · plays alongside the recursion tutorial
🛡️
Errors & exceptions

Exception Arena

Survive every input the arena throws

6 levels · plays alongside the errors & exceptions tutorial
🗄️
File handling

File Cabinet

Read, write and append — and see every file change

6 levels · plays alongside the file handling tutorial
🧰
Modules & the standard library

Module Market

Pick the right tool off the shelf

6 levels · plays alongside the modules & the standard library tutorial
🧬
Classes & objects

Creature Lab

Design the blueprint, then spawn from it

6 levels · plays alongside the classes & objects tutorial
🏝️
Inheritance

Inheritance Island

Build on a class instead of copying it

6 levels · plays alongside the inheritance tutorial
🚰
Generators & yield

Pipeline

Produce values one at a time, not all at once

6 levels · plays alongside the generators & yield tutorial
📈
Algorithms & Big-O

Algorithm Dojo

Make it correct, then make it scale

6 levels · plays alongside the algorithms & big-o tutorial
🗓️
One puzzle a day

Daily Challenge

A new puzzle every day, and a streak to keep

21 puzzles in rotation · a new one every day
Boss mode

Challenge games

Longer games that mix several topics together. Play these once the basics feel comfortable — or whenever you want a puzzle rather than a lesson.

🤖

Python Robot Maze

Write real Python — and do not fall off

Guide a robot along 6 floating walkways with move(), turn_left() and while loops. Step off the path and it falls into the void — so every move has to be checked first.

LoopsConditionsFunctionsBooleans
Beginner → Intermediate6 levels10–20 min
Play now →
🎯

Guess the Output

Beat the clock on 24 Python snippets

A timed quiz: read a short Python program and predict exactly what it prints. Three lives, streak bonuses and an explanation after every answer.

OperatorsStringsListsDictsGotchas
Beginner → Advanced24 questions5–10 min
Play now →
🐛

Bug Squash

Fix the broken code until the tests pass

Eight Python functions are subtly broken — off-by-one errors, mutable defaults, missing returns. Fix each one and the hidden tests tell you instantly.

DebuggingFunctionsListsDictsEdge cases
Beginner → Intermediate8 bugs10–25 min
Play now →
🐢

Turtle Art Challenge

Draw the shape with loops

Six drawings to recreate with Python turtle commands — a square, a star, a flower of squares. Loops do the work; your code is drawn live on the canvas.

LoopsNested loopsAnglesFunctions
Beginner → Intermediate6 drawings10–20 min
Play now →
🧩

Code Scramble

Put the shuffled program back together

The lines of a working Python program have been shuffled. Drag them back into the right order — no typing, so it plays perfectly on a phone.

Reading codeProgram flowIndentationLogic
Beginner → Intermediate8 puzzles5–15 min
Play now →
⛳

Python Code Golf

Solve it in the fewest characters

Eight tasks, one rule: make the tests pass with as little code as possible. Beat par and learn the comprehensions and built-ins that make Python short.

ComprehensionsBuilt-insSlicingExpressions
Intermediate8 holes15–30 min
Play now →
Adventure mode

Python learning games: 10 adventures

Ten illustrated games — a quest, a space shooter, turtle drawing, a Karel-style robot, a farm, a treasure hunt, a maths platformer, a rocket, a kingdom and word locks. Each one teaches the same path: calling functions, for loops, variables, functions, if and while.

Python Quest game screen
🗺️

Python Quest

Python adventure game

Guide Pip across forests, bridges and meadows to the treasure — every step is a line of real Python you write yourself.

Beginner6 levels20–30 min
Play now →
Code Defender game screen
🚀

Code Defender

Python space shooter game

Aliens are heading for the base. You do not get a joystick — you get a Python editor.

Beginner6 levels20–30 min
Play now →
Python Painter game screen
🎨

Python Painter

Python turtle online

Draw with Python turtle in your browser — trace the dotted shape on each canvas, then paint whatever you like.

Beginner7 levels20–40 min
Play now →
Robot Factory game screen
🤖

Robot Factory

Karel python

A Karel-style robot that only knows how to move, turn left and pick things up. Everything else, you teach it in Python.

Beginner6 levels20–30 min
Play now →
Python Farmer game screen
🌻

Python Farmer

Python farming game

Plant, water, sleep, harvest — a cosy farming game where every chore is a line of Python.

Beginner6 levels20–30 min
Play now →
Treasure Hunter game screen
🏴‍☠️

Treasure Hunter

Python treasure hunt game

X marks the spot — but only if your code can get there. A pirate island treasure hunt written in Python.

Beginner6 levels20–30 min
Play now →
Math Island game screen
🏝️

Math Island

Python math game

A side-view platformer where every jump is a calculation. Get the maths right in Python and you land on the next rock.

Beginner6 levels15–25 min
Play now →
Space Explorer game screen
🛰️

Space Explorer

Python rocket game

Rockets do not stop when you stop pushing. Plan every thrust in Python and dock without overshooting.

Beginner6 levels20–30 min
Play now →
Castle Builder game screen
🏰

Castle Builder

Python strategy game

Gold, houses, farms, knights and goblin raids — a small kingdom-builder you run entirely from a Python script.

Beginner6 levels25–35 min
Play now →
Word Locks game screen
🔐

Word Locks

Python string game

Every door in the museum has a word lock. Build the right string in Python and it clicks open.

Beginner6 levels15–25 min
Play now →

Why learning Python with games works

Reading a tutorial feels productive, but recognition is not the same as recall. You can nod along to an explanation of while loops and still freeze when an empty editor asks you to write one. Games fix that by forcing three things that research on learning keeps pointing to:

  • Active retrieval. Every level makes you produce code from memory instead of recognising it on a page.
  • Immediate feedback. You find out in seconds whether your mental model of range() or % was right — before the misunderstanding has time to set.
  • Just-enough difficulty. Each level adds one idea. You are never stuck for long, and never bored.

There is a catch worth saying plainly: games are practice, not a curriculum. They will make you fast and confident with the syntax you already half-know, but they will not teach you a topic from scratch. The combination that works is a short lesson, then a level or two that uses it. The free Learn Python course on this site is ordered to pair with these games exactly that way.

Which Python game should you play first?

The concept games are ordered — play them in this order and each one assumes only what the last taught.

GameBest forYou need to knowTeaches
Variable VaultYour first hour of PythonNothingAssignment, int/float/str, conversion, None, unpacking
Operator ArcadeRight after variablesStoring a valueArithmetic, // and %, precedence, comparison, rounding
String SurgeonAnyone unsure about slicingVariables and typesIndexing, slices with steps, string methods, f-strings, join
GatekeeperBefore your first real programComparisonsif/elif/else, and/or/not, boundaries, membership
Loop FactoryThe last of the basicsConditionsfor, range steps, accumulating, while, break, nesting
Crate StackYour first data structureLoopsIndexing, append/insert/remove, slicing, sorted vs .sort()
Dict DetectiveAfter listsListsDicts, .get(), the counting pattern, sets and overlap
CompressorOnce loops and lists are easyLoops and listsList, dict and set comprehensions, filtering, nesting
Function ForgeBefore you write anything longer than a scriptLoops and conditionsdef, return, defaults, keyword arguments, scope
Recursion TowerAfter functions feel naturalFunctionsBase cases, the call stack, Fibonacci, nested data
Exception ArenaBefore anything handles real inputFunctionstry/except, specific types, finally, raise, custom exceptions
File CabinetYour first program that keeps dataLoops and stringsopen(), with, appending, JSON, CSV
Module MarketAny time — it saves you writing codeFunctionsmath, random, datetime, Counter, itertools, statistics
Creature LabOnce functions and dicts feel easyFunctionsclass, __init__, self, methods, __str__, __eq__
Inheritance IslandStraight after classesClassesSubclassing, overriding, super(), polymorphism, MRO
PipelineThe last of the core languageLoops and functionsyield, laziness, generator expressions, yield from
Algorithm DojoOnce the language itself is comfortableLoops, lists, setsLinear and binary search, sorting, hash look-ups, Big-O
Daily ChallengeEvery day, at any levelAnything you have learnedA mixed five-minute puzzle, with a streak
Python Robot MazeYour first week of PythonCalling a function: move()Loops, conditions, booleans, decomposition
Guess the OutputAnyone who has written a few programsBasic syntax and data typesReading code precisely, operators, mutability, gotchas
Bug SquashAfter you can write small functionsFunctions, lists, dictionariesDebugging, edge cases, reading error messages
Turtle Art ChallengeVisual learners, week one onwardsCalling a functionLoops, nested loops, angles, decomposition
Code ScramblePlaying on a phone, or before writing a program yourselfNothing — no typing at allProgram flow, indentation, reading code
Python Code GolfOnce loops and lists feel comfortableFunctions, lists, stringsComprehensions, slicing, lambdas, built-ins
Python QuestVisual learners and kidsNothingCalling functions, for loops, Variables, Functions, if statements, while loops
Code DefenderVisual learners and kidsNothingCalling functions, for loops, Variables, Functions, if statements, while loops
Python PainterVisual learners and kidsNothingCalling functions, for loops, Variables, Functions, if statements, while loops, Free drawing
Robot FactoryVisual learners and kidsNothingCalling functions, for loops, Variables, Functions, if statements, while loops
Python FarmerVisual learners and kidsNothingCalling functions, for loops, Variables, Functions, if statements, while loops
Treasure HunterVisual learners and kidsNothingCalling functions, for loops, Variables, Functions with inputs, if / elif, while loops
Math IslandVisual learners and kidsNothingMath in code, for loops, Variables, Functions that return, if statements, while loops
Space ExplorerVisual learners and kidsNothingCalling functions, for loops, Variables, Functions with inputs, if / elif, while loops
Castle BuilderVisual learners and kidsNothingCalling functions, for loops, Variables and //, Functions with two inputs, if statements, while loops
Word LocksVisual learners and kidsNothingStrings, for loops over strings, Joining strings, Functions and slicing, if statements, while loops

If you have never written a line of Python, spend ten minutes on what Python is and loops first — then Robot Maze will click immediately.

Python games for beginners, kids and adults

All the games start from zero and assume nothing beyond the level before, so they suit complete beginners of any age.

  • Complete beginners — play the concept games in order, starting with Variable Vault. Each one is the practice half of a short free tutorial.
  • Kids and younger learners — Turtle Art turns loops into drawings and Code Scramble needs no typing at all, which makes both a gentle first step.
  • Adults learning for work or school — take the concept games quickly, then use Guess the Output and Bug Squash for the code-reading and debugging skills interviews and exams test.
  • Already comfortable with Python — Code Golf and the later Robot Maze levels are where the real puzzles are.

Rather build a game than play one? Ten simple Python games with code — number guessing, hangman, tic-tac-toe, blackjack, snake and more — open straight in the online compiler.

34 games, several different skills

The concept games each own one topic. The challenge games are deliberately not six versions of the same puzzle either — programming is several separable skills, and each one trains a different skill:

  • Writing code from nothing — Robot Maze.
  • Reading code precisely enough to predict it — Guess the Output.
  • Debugging code that is nearly right — Bug Squash.
  • Thinking in loops, with the result drawn in front of you — Turtle Art.
  • Structuring a program: what goes where, and inside which block — Code Scramble.
  • Refactoring — the same behaviour in less code — Code Golf.

Most people are much better at some of these than others, and the gap is usually invisible until something makes you do each one separately.

What makes these different from most "coding games"

A lot of games marketed as Python games are really drag-and-drop block puzzles with a Python skin, or multiple-choice quizzes dressed up with points. Four of the six games here execute the code you type on a genuine CPython interpreter compiled to WebAssembly, so a stray colon produces a real SyntaxError, an endless loop is caught and stopped, and print() output appears in the console exactly as it would in a terminal. The other two need no runtime — and their content is still verified: every quiz answer and every scrambled program is executed on CPython when this site is built, and the build fails if a single stated output is wrong.

Keep practising after the games

Prefer to code on your phone? The Coding Python app is a full Python 3 editor and interpreter for Android, with a coding keyboard, 30 examples and 12 challenges.
Get the free app

Frequently asked questions

Are these Python coding games free?

Yes. Every game runs in your browser with no account, no sign-up and no install. They are free to play as often as you like.

Do I need to install Python to play?

No. Every game that asks you to write code — the concept games, Robot Maze, Bug Squash, Turtle Art and Code Golf — runs a real Python interpreter (CPython compiled to WebAssembly) inside the page, so your code is executed properly without anything installed. It is downloaded only when you first run something, and Guess the Output and Code Scramble need no runtime at all.

Which Python coding game should a complete beginner start with?

Start with Variable Vault, then work along the concept row: operators, strings, if/else, loops. Each one is six short levels on a single topic and pairs with the matching tutorial. Once those feel easy, Robot Maze is the natural first challenge game — its opening level needs a single move() call.

Can I play these Python games on a phone?

Yes, all of them are built for small screens and the code editors have a symbol bar for the characters that are awkward on a phone keyboard. For longer coding sessions on Android, the Coding Python app has a full editor and interpreter.

Do coding games actually help you learn Python?

They help with the part tutorials are worst at: retrieval and feedback. A game forces you to recall syntax from memory and shows you the result in seconds, which is exactly the loop that builds fluency. They work best alongside a structured course rather than instead of one.

Is my progress saved?

Levels you finish, your best quiz score and the code you have typed are stored in your own browser (localStorage). Nothing is uploaded, and clearing site data resets it.

What Python version do the games use?

Python 3 — the same syntax as the tutorials on this site. Everything you type is standard Python that would run unchanged on a computer or in the Coding Python Android app.

What are the best Python coding games?

It depends on what you want. CodeCombat is a polished dungeon game with a free start and a paid plan for the full campaign; CheckiO and Codewars set puzzle-style challenges for people who already know the basics; Codédex wraps a beginner course in a fantasy map. The games on this page are free in full, need no account, and each one drills a single topic with real Python running in the page — a good fit for practising alongside a course.

Are these Python games good for kids?

Yes, for children who can read and type comfortably — usually from about ten upwards. Turtle Art (drawing with code) and Code Scramble (no typing) are the gentlest starts; the concept games then teach one idea at a time. There are no ads inside the games, no chat and no account.

Are there more Python games coming?

Yes. Exceptions, files, classes, inheritance and generators are the next topics planned for concept games. The 12 self-checking challenges and 112 quiz questions in the Coding Python app are the closest thing to extra levels in the meantime.

Take the games with you

Coding Python packs a real Python 3 compiler, 30 example programs, 112 quiz questions and 12 self-checking challenges into one free Android app.

Get it on Google Play
Coding Python app icon