Variables (and why they’re not what you think)
The problem...
At some point, you need to store information. A name. A number. A result.
Most tutorials say: "Variables are containers."
That sounds fine. But it creates confusion later.
The idea!
A variable is not a container. It's a label. A name you give to a value.
Making it real
Think of it like this: you write on a piece of paper name → Alex.
Now, instead of writing "Alex" everywhere, you just use name.
That's all a variable does.
In practice
name = "Bull"
print(name)
What happens?
"Bull"is the valuenameis the labelprint(name)uses that label
Output → Bull
Why this matters?
Without variables, you repeat yourself. With variables, you:
- reuse values
- change things easily
- keep your code clean
Going further
name = "Bull"
print("Hello", name)
Output → Hello Bull
Now change one line:
name = "John"
print("Hello", name)
Output → Hello John
Everything updates. You changed one value. The rest followed.
What's really happening
You are giving names to things. That's it. No magic.
The name stays the same. The value can change. The output follows the value.
Heads up!
- Don't think "name contains Bull" — think "name points to Bull"
- If you think "box", things break later. If you think "label", everything stays clear
- The full syntax is
[start:stop:step]— butstepis advanced, you don't need it now
A simple exercise
age = 25
print(age)
Now change the value. See what happens.
The mindset shift
Stop thinking: "I store things in variables."
Start thinking: "I give names to values."
What you should understand now
- Variables are labels, not boxes
- They make code flexible
- You can change values easily
- Names help you think clearly