Home Module 4: Python Basics Lesson 4.2
Module 4: Python Basics

Variables — labelled boxes that store things

⏱ 20 min learn Ages 9 & 12
💡 The big idea

A variable is a named box that stores a value. You can put anything in it, look at it, change it, and use it in calculations. Variables are the building blocks of every program ever written.

📦
The labelled box analogy
"A variable is like a labelled box. You put something inside, label it, and then use the label whenever you need what's inside. In Python: name = 'Alex' creates a box labelled name with 'Alex' inside."
name = "Alex" # string — text goes in quotes age = 12 # integer — whole number, no quotes height = 1.54 # float — decimal number print("Hello,", name) print("You are", age, "years old")
🔨
Build the My Info program
Write a Python program that asks for my name, age, and favourite colour using input(), then prints a fun personalised sentence using all three variables. Explain each line for a 10-year-old beginner.
🗣 Try: Change the value stored in one variable and run the program again. Does the output change? What happens if you try to add a string and a number together?
📝
Lesson quiz — test yourself!
Wrap-up discussion questions
1️⃣ What are the three variable types you learned today?
2️⃣ Why do strings need quote marks but integers don't?
3️⃣ What happens if you try to use a variable name that doesn't exist?
📍 Lesson 4.2 — Python Basics
← Previous Next →