🧩Variable
A named box in a program that holds a value. The value can change.
Think of it like
Think of it like a box with a name on the lid. You can put something in, look inside, or swap it.
Example
A game keeps the player's points in a variable called score. Each coin adds 10, so score goes 0, 10, 20.
Why it matters
Programs remember things in variables. Without them, a program could not keep a score, a name or a total.
Definition
Example code
python
>>> score = 0
>>> score = score + 10
>>> score
10Common mistake
Key takeaways
- 1A name and a value. The name points to what is stored.
- 2Can change. A new value can replace the old one.
- 3Name it well. Say what is inside, not just a letter.