Variables
What a variable is, how to create one, naming rules, multiple assignment and printing a value — from start to finish.
Simple enough for a 5-year-old to understand
Variable: a box that stores information
A variable is a name you give to a value. Think of it as a box where you keep the value, with a label stuck on it.
In Python there is no separate command to create a variable — a variable is created the moment you assign a value.
x = 5name = "Alex"print(x)print(name)The value can change
You can later put a new value into the same box; the old one is erased.
score = 10score = 20print(score)🎯 Exercise & Practice
Test what you've learned — answer, write code, check instantly. (2 left)
🎯 Expected output: Madrid