Variable Vault — Variables & data types
Six vaults, each opened by storing exactly the right value in exactly the right type.
How to play
Each level asks for one or more variables with specific values. Write them in the editor and press Run. Your code is executed on a real Python interpreter, then every variable the level cares about is shown in a box with its value and its type — which is the whole point of this game. Most beginner confusion about variables is really confusion about types, and the boxes make the difference impossible to miss.
A check only passes when both match. age = "30" will never satisfy a check that wants the integer
30, and the failure message tells you exactly that.
What each level teaches
- Open the vault — assignment. A variable is a label pointing at a value, not a box containing one.
- Mind the type —
intversusstr. Quotes change what a value is, so"30" + 1is an error while30 + 1is 31. - The swap — multiple assignment.
a, b = b, aworks because Python evaluates the whole right-hand side first. - Convert it —
int(),float()and f-strings. Data arrives as text; converting it is step one of nearly every real program. - Empty and nothing — falsy values and
None. An empty string is a value;Noneis the absence of one. - Unpack the pair — tuple unpacking, the mechanism behind returning several values from a function.
Three mistakes this game is designed to catch
- Storing numbers as text. Everything looks fine until you try arithmetic. The type badge shows it immediately.
- Confusing
None,0,Falseand"". All four are falsy; none of them are equal to each other in the way beginners assume. - Thinking
=means equals. It means "store this here".==is the one that asks a question.
The written explanation of all of this is in the tutorial on Python variables and data types, which pairs with this game level for level.
Frequently asked questions
Is this Python variables game free?
Yes. It runs entirely in your browser with no account and no install, and your code never leaves your device.
Does it run real Python?
Yes. Your code is executed by CPython compiled to WebAssembly in a background worker, so types, errors and edge cases behave exactly as they would on a computer.
What is the difference between a variable's value and its type?
The value is what is stored; the type is what kind of thing it is. 30 and "30" look identical when printed but behave completely differently — one can be multiplied, the other can be sliced. Every box in this game shows both for exactly that reason.
Do I need to know anything before playing?
No. Level 1 asks you to write two lines. If you have never seen Python at all, read the variables and data types tutorial first — it takes about ten minutes.
Is my progress saved?
Levels you solve and the code you have written are stored in your own browser. Nothing is uploaded, and clearing site data resets it.
Keep going
- Read the variables & data types tutorial — the written explanation behind every level here.
- Operator Arcade — numbers & operators.
- String Surgeon — strings & slicing.
- Gatekeeper — if, elif and else.
- 20 Python practice exercises with worked solutions.
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