Skip to content
    Pythonia

    VARIABLES & DATA TYPES · 8 MIN

    Variables

    A variable is a name that points to a value stored in memory.

    PYRA explains

    • Use = to assign: score = 10 makes the name score refer to the value 10.
    • Re-assigning moves the label to a new value; the old value is not modified.
    • Names are case-sensitive and cannot start with a digit.

    Real world: A labelled storage box in a warehouse — the label is the name, the item inside is the value.

    Watch it move

    score
    10

    score = 10

    1/3

    Code

    score = 10
    score = score + 5
    name = "Cubo"
    print(name, score)
    Output ›
    Cubo 15
    Try it in the online compiler →

    Checkpoint quiz

    After x = 4 then x = x * 2, what is x?

    Which is a valid variable name?