← Python

Variables

A variable stores a value under a name using the = assignment operator

What it does: A variable stores a value under a name so it can be reused later, created with the assignment operator: name = 'Alice'. The name goes on the left, the value on the right. Once assigned, a variable can be read back or reassigned at any point, and Python figures out its type automatically from whatever's assigned to it.

Common mistakes: A single = assigns a value; a double == compares two values — mixing them up (age == 15 instead of age = 15) is one of the most common beginner errors. Variable names also can't start with a digit — 2score is invalid, score2 is fine.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a journey and assign it to your class.

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
What does x = 5 do?
Stores 5 in xChecks if x equals 5
Matches
❌ 3name = 'Bob'
Error: Starts with number
Applying
Meanings
Term
name = 'Alice'
Meaning
Variables store values using = (assignment operator)
Practice
name = "Alice"
Testing
Gaps
= 'Bob'
Check Answer
Spots
1name = 'Alice'
2age == 15

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'African Wild Dog' badge — Savannah Streak, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. What does x = 5 do?
A. Stores 5 in x ✓
B. Checks if x equals 5
= is assignment — it stores the value on the right into the variable on the left
2. After name = 'Alice', what is stored in name?
A. name
B. Alice ✓
The variable name holds the value 'Alice', not the word 'name'
3. Which is correct assignment?
A. age = 15 ✓
B. 15 = age
The variable goes on the left, the value on the right — you can't assign to a number
4. What does = mean in Python?
A. Equality
B. Assign ✓
= assigns a value to a variable — use == to test if two values are equal
5. After score = 100, what is stored in score?
A. 100 ✓
B. score
The variable holds the value — score contains 100, not the word 'score'

Match the Pairs

3name = 'Bob' Error: Starts with number
my-score = 5 Error: Hyphens not allowed
name3 = 'Bob' Valid: Number after first char
my_score = 5 Valid: Underscore ok
x = 10 print(x) Output: 10
name = 'Alice' print(name) Output: Alice

Key Term

name = 'Alice'
Variables store values using = (assignment operator)

Fill in the Blanks

1. name = 'Bob' print(name)
2. age = 15 print(age)
3. score = 100 print(score)
4. city = 'Melbourne' print(city)
5. age = input('Enter Age: ') print(age)

Spot the Error

Question 1
A name = 'Alice'
B age == 15
C print(name)
Line B — Line 2 uses == (comparison) instead of = (assignment). Should be: age = 15
Question 2
A name = 'Bob'
B 2score = 100
C print(name)
Line B — Line 2 starts with a number. Variable names cannot start with numbers. Should be: score2 = 100
Question 3
A name = 'Alice'
B age = 15
C print('name')
Line C — Line 3 prints the string 'name' instead of the variable. Should be: print(name)
Question 4
A age = 16
B student-name = 'Charlie'
C grade = 11
D print(student-name)
Line B — Line 2 uses hyphens which aren't allowed in variable names. Should be: student_name = 'Charlie'
Question 5
A name = 'Diana'
B age = 15
C school = Parkdale High
D print(school)
Line C — Line 3 is missing quotes around the string value. Should be: school = 'Parkdale High'
For Teachers

Create a free class, add this module to a journey, and track who's stuck.

Create a free teacher account →

No credit card. No setup fee. Make a class and invite students in under three minutes.

For Students

Practice this topic interactively, track progress, and unlock badges.

Start Learning Free →

Have a class code?