Practice · All units

Python Challenge

Ten progressive coding challenges across the Python syllabus

Python Challenge · 10 progressive levels

Debug a line. Build a solution. Combine what you know.

Work through ten short levels aligned with Units 1–5. Each level begins with editable Python, a clear objective, and an optional hint. Run your code to check its output. Passing a level unlocks the next one, and your completed levels and XP are saved in this browser.

0/10

levels completed

0

XP earned

175

XP available

Challenge pathway

Complete levels in order to unlock the next

Level 1 · Unit 2 · Control flow

Make the range reach its stop

Debug · off-by-one · 10 XP

Your task

The loop should print 1, 2, 3, and 4. Fix the range so the final value appears.

Edit the starter code below, run it, and compare the result with the goal.

Level 1 · Debug · off-by-one
Starting up Python…
# Fix the endpoint so the loop includes 4.
for number in range(1, 4):
    print(number)
The editor is ready while Python loads in the background.

Output

Your program's output will appear here.
Common Python mistakes

NameError: name 'mark' is not defined

NameError: A name was used before Python could find a variable or function with that name.

IndexError: list index out of range

IndexError: The requested position is outside the items in this list or sequence.

KeyError: 'email'

KeyError: That key does not exist in this dictionary.

TypeError: can only concatenate str (not "int") to str

TypeError: This operation does not work with the kind of value it received.

ZeroDivisionError: division by zero

ZeroDivisionError: A number cannot be divided by zero.

SyntaxError: invalid syntax

SyntaxError: Python could not understand the structure of this line. Check spelling, brackets, colons, and quotes.

IndentationError: expected an indented block

IndentationError: The spaces at the start of a line do not match Python's block structure.

What to expect as you progress

Levels 1–3 · Debug

Fix range boundaries, type conversion, and comparison logic.

Levels 4–7 · Build

Use collections, string methods, functions, and recursion.

Levels 8–10 · Combine

Apply imports, NumPy, and a small dictionary-based expense project.

Projects stay within the taught syllabus. The employee-management idea is represented with dictionaries; object-oriented classes are not required here.