Variables and Assignment
Programs would be useless if they couldn't remember anything. Variables are how Python remembers — and today they click for you forever.
The mental model: a labeled box
A variable is a box with a label. You put a value in, and the label lets you find it later:
name = "Galvan"Read that line as: *"create a box labeled name, and put the text Galvan inside."* The = sign is not "equals" like in math class — it's the assignment operator: "put the right side into the left side."
The pattern: name = value
score = 99 # a number
player = "Rohit" # text (a string)
is_game_over = False # a True/False flagThree assignments, three boxes. Python figures out what kind of value each holds — you never announce the type.
Variables can change (that's why they're called variables)
score = 10
print(score) # 10
score = 50
print(score) # 50 — the old 10 is gone, replacedAssignment overwrites. The box labeled score now holds 50; the 10 is forgotten forever.
Variables can be built from other variables
base_price = 100
tax = 18
total = base_price + tax
print(total) # 118The right side is computed first, then stored. total holds 118 — and importantly, it holds a *copy* of the value, not a live link. Change base_price later and total stays 118 until you reassign it.
The update pattern (self-assignment)
score = 10
score = score + 5 # right side computes 10+5=15, THEN stores into score
print(score) # 15This looks like math nonsense ("x = x + 5"?) but reads as an instruction: *"take the current score, add 5, put it back."* This pattern appears in almost every app you'll build — counters, totals, streaks. Python even has a shorthand you'll meet in the operators module: score += 5.
Naming recap (from the tokens lesson)
snake_case, descriptive — total_price beats tpscore and Score are different boxesCommon Errors & Fixes
age = "5" + 1. Text plus number doesn't mix; convert first (int("5") + 1) — the type conversion lesson covers this fully.if block that never ran, so the assignment never executed.✅ Checkpoint
= mean in Python? *(Assignment — put the right side into the left side)*x = 5 then x = x + 2 then print(x) *(7)*a = b = 10... actually, try it: does Python allow it? *(Yes — both labels point to 10)*total = base + tax and you later change base, does total update? *(No — total holds a copy of the old result)*Next: numbers — the arithmetic your apps will run on, including the division gotcha.