Python Exercises
Each Python lesson has a fill-in-the-blank exercise. Complete a short snippet with one or two missing tokens — the grader checks your answer against the expected output.
How it works
- Read the instruction at the top.
- Click the blank, type your answer, press Run.
- A wrong answer triggers a hint; the second wrong try reveals the solution.
Why fill-in-the-blank
| Format | What it tests |
|---|---|
| Multi-choice quiz | Recognition — "I've seen this." |
| Fill-in-the-blank | Recall — "I can produce this." |
| Open-ended | Synthesis — "I can build this from scratch." |
Recall is the strongest predictor of retention. Blanks are small so the cognitive load stays on the concept.
Sample
PYTHON
# Instruction: print "Hello, world!" print(____)
Answer: 'Hello, world!'.
Where to go next
- Finish all 60+ Python exercises to unlock the "Built it from blanks" badge.
- Try the 30-day bootcamp for daily challenges.
- Pair every exercise with a Try it Yourself » in the editor — vary the snippet to build intuition.
Tip: If a blank stumps you, scroll up — the lesson's example almost always demonstrates the answer.
Example
Example
# Fill-in-the-blank to complete the line:
# print('Hello, ____!')
print('Hello, world!')
Try it Yourself »
Exercise
Exercise format is fill-in-the-…
fill-in-the-
Five letters.
Discussion
Loading…