Variables — naming rules, assignment, reassignment
WHAT is a variable?
HOW assignment works
Why right-to-left? Because the value must exist before a name can point to it. You can't label nothing.
HOW reassignment works

Naming RULES (must obey — else SyntaxError)
Steel-man: common mistakes
Flashcards
What does the = operator do in Python?
In what order is name = expression processed?
Why is x = x + 5 valid in Python?
= is assignment; the old value of x is used to compute the result, then x is rebound to the new object.After a=100; b=a; a=200, what is b?
b still labels the original object; reassigning a only moved a's reference.Can a variable name start with a digit?
Is Age the same variable as age?
Name three things forbidden in a variable name.
- @, and reserved keywords.What error comes from using a name before it's assigned?
What does reassignment do to the OLD object?
What's the convention for naming a constant?
MAX_SPEED = 120.Recall Feynman: explain to a 12-year-old
Imagine names are sticky labels and values are toys. Saying score = 10 makes a toy "10" and sticks the label score on it. Saying score = 20 does NOT change the old toy — it peels the label off and sticks it on a new toy "20". If your friend put a label copy on the first toy, their label is still on toy "10" even after you moved yours. The = sign isn't saying "these are equal" — it's saying "go stick this label here."
Connections
- 1.2.01-Data-Types — the objects that variables point to.
- 1.2.02-Operators —
=(assign) vs==(compare). - 1.2.04-Mutable-vs-Immutable — why
b=ais safe for ints but tricky for lists. - 1.2.05-Namespaces-and-Scope — where names live.
- 1.1.00-Memory-and-References — heap objects and the garbage collector.
Concept Map
Hinglish (regional understanding)
Intuition Hinglish mein samjho
Dekho, Python me ek variable koi dabba (box) nahi hai jisme value rakhi ho — wo ek naam ka label hai jo memory me pade ek object ko point karta hai. Jab tum likhte ho x = 10, to pehle right side ka object 10 banta hai, phir naam x us object par chipak jaata hai. Isiliye = ko "barabar" mat padho — ise padho "right side run karo, phir uska label name ko de do". Yahi reason hai ki x = x + 5 bilkul valid hai: pehle purana x (10) use karke 15 banta hai, phir x ko naya label mil jaata hai.
Reassignment ka matlab — naam ka sticky note utha kar dusre object par chipka dena. Purana object change nahi hota; agar uspe koi aur label nahi bacha to garbage collector use saaf kar deta hai. Aur ek important baat: b = a value ki copy nahi, reference ki copy karta hai. To agar baad me a = 200 karo, to sirf a ka label hila, b abhi bhi purane 100 ko point kar raha hota hai.
Naming rules simple hain: sirf letters, digits aur underscore; pehla character digit nahi ho sakta; spaces ya -, @ jaise symbols nahi; aur keywords (if, class, for) use nahi kar sakte. Case matter karta hai — age aur Age alag hain. Convention me snake_case aur descriptive naam use karo, kyunki 80% bugs galat ya confusing naam se aate hmain. Yeh chhoti cheez lagti hai par poore programming ka foundation hai.