
Whenever I introduce variables, I start with a simple sentence:
“A variable is just a container that stores information.”
Think about your phone contacts.
You save:
- Name → Azeem
- Number → 0300xxxxxxx
The name is like a variable, and the number is the value stored inside it.
Same concept in Python.
Creating Your First Variable
In Python, we don’t need complicated rules to create variables.
Just write:
name = "Azeem"BashThat’s it.
Python automatically creates the variable.
I tell students:
The equal sign (=) does NOT mean math here.
It means “store this value inside this variable.”
So:
name ← Azeem
Printing Variables
We can display it using print():
name = "Azeem"
print(name)PythonOutput:
Azeem
Python looks inside the container and prints the value.
Multiple Variables Example
name = "Ali"
age = 20
city = "Lahore"
print(name)
print(age)
print(city)PythonEach variable stores different information.
Variable Types (Important Concept)
I explain this using real-life objects.
Different containers hold different things:
- Bottle → liquid
- Wallet → money
- Box → items
Similarly, variables store different data types.
1. String (Text)
name = "Azeem"PythonText always inside quotes.
2. Integer (Whole Numbers)
age = 25PythonNo quotes needed.
3. Float (Decimal Numbers)
price = 99.99Python4. Boolean (True/False)
is_student = TruePythonI call this the Yes/No variable.
Changing Variable Values
Variables can change anytime.
age = 20
age = 21PythonNow Python remembers only 21.
Analogy:
A whiteboard — you erase old value and write new one.
Rules for Naming Variables
I give students 4 simple rules:
✅ Allowed:
name
user_age
totalMarks
❌ Not allowed:
1name # cannot start with number
user-name # dash not allowed
Best practice:
Use meaningful names.
Bad:
x = 10PythonGood:
price = 10PythonMultiple Assignment Trick (Students Love This)
Python allows:
a, b, c = 1, 2, 3PythonAnd:
x = y = 100PythonVery powerful feature.
Real Example — Student System
student_name = "Ali"
student_age = 21
course = "Python"
print("Name:", student_name)
print("Age:", student_age)
print("Course:", course)PythonNow students see real-world usage.
Common Beginner Mistakes
❌ Forgetting quotes
name = Azeem
Error.
Python thinks Azeem is another variable.
Correct:
name = "Azeem"PythonMy Golden Teaching Tip
I always tell beginners:
Variables are the memory of your program.
Without variables, programs cannot remember anything.
And programming without memory is useless.
Small Practice Task I Give Students
Try this:
name = "Your Name"
age = 18
favorite_language = "Python"
print(name, age, favorite_language)PythonSimple — but powerful start.
Your Name 18 Python