Lesson 2 of 13

Variables are Magic Boxes! 📦

Think of a variable like a special labelled box — you put something inside and use it whenever you need it!

What is a Variable? 🤔

Simple explanation — no confusing words!

A Variable is Like a Labelled Box

Imagine you have a box with “myName” written on it. You put your name inside — “Sara”. Whenever the computer needs to know your name, it just opens that box!

That’s exactly what a variable does. It stores information with a name so you can use it later. Easy, right? 😊

📦
myName
“Sara”
Holds a name!
📦
myAge
10
Holds a number!
📦
isHappy
true
Holds yes/no!

Variables in Real Life 🌍

You already use variables every day — without knowing it!

I remember when I first learned about variables — I thought they were some scary math thing. Then my teacher said “think of your schoolbag.” That’s when it clicked for me!

🎒
Your Schoolbag
Changes what’s inside every day!
🏆
Game Score
Goes up every time you win points!
🌡️
Temperature
Changes every single day!
❤️
Player Health
Goes down when you get hit!

How to Create a Variable 💻

3 parts — name, equals, value. That’s it!

Creating a variable is just 3 simple parts. Look at this Python example — it reads almost like English!

variables.py
# Create variables — easy!
name   = "Sara"
age    = 10
score  = 0

# Use them!
print("Hello, my name is", name)
print("I am", age, "years old")
🟡

name — this is the box label (what you call it)

🟰

= — means “put this inside the box”

🟢

“Sara” — this is what goes inside the box!


You Can Change What’s Inside! 🔄

Just like emptying a box and putting something new in!

The best thing about variables? You can change them anytime. Think of a game score — it starts at 0 and goes up every time you win points! 🎮

score = 0 🎮 Game Starts
score = 10 ⭐ You scored!
score = 25 🏆 Even more!

What Can You Store? 🎨

Variables hold 4 main types of information!

Variables aren’t just for numbers. They can hold all kinds of things — text, numbers, yes/no answers, and even lists!

🔢
Numbers
age = 10
📝
Text
name = "Sara"
Yes / No
happy = True
📋
Lists
pets = ["cat"]

Common Mistakes Kids Make 😅

Don’t worry — every coder makes these at first!

When I started coding, I made all of these mistakes. Every single one. That’s totally normal — now I’m sharing them so you can skip the confusion! 😄

Spaces in variable names — my name = "Sara"
✅ Use underscore instead — my_name = "Sara"
Starting with a number — 1score = 0
✅ Start with a letter — score1 = 0
Forgetting quotes for text — name = Sara
✅ Always use quotes — name = "Sara"

🧠 Quick Quiz!

Test what you just learned — no pressure, just fun!

🎯 Variables Quiz

4 questions · tap an answer to check!

⭐ Remember This!

1
A variable is like a labelled box that stores information
2
Every variable has a name and a value
3
You can change what’s inside a variable anytime
4
Variables hold numbers, text, yes/no, and lists