Coding Python
Home›Python Coding Games›Variable Vault

Variable Vault — Variables & data types

Six vaults, each opened by storing exactly the right value in exactly the right type.

Level 1

Checks
    Your PythonPython 3
    1

    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

    1. Open the vault — assignment. A variable is a label pointing at a value, not a box containing one.
    2. Mind the type — int versus str. Quotes change what a value is, so "30" + 1 is an error while 30 + 1 is 31.
    3. The swap — multiple assignment. a, b = b, a works because Python evaluates the whole right-hand side first.
    4. Convert it — int(), float() and f-strings. Data arrives as text; converting it is step one of nearly every real program.
    5. Empty and nothing — falsy values and None. An empty string is a value; None is the absence of one.
    6. 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, False and "". 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.

    Practise variables & data types on your phone — the Coding Python app runs real Python 3 on your phone, with examples, quizzes and challenges built in.
    Get it free

    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

    ← All Python coding games  Read the tutorial →

    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