Education digital-technologies year-9
Chapter 3 - Variables
A lesson focused on storing information and reusing it clearly through variable names.
Chapter 3 introduces variables as named pieces of information the program can remember and display.
Chapter Navigation
Learning Intention
- store data in variables
- use meaningful variable names
- output values by combining text and variables
Variable Naming Guidance
- use descriptive names:
researcher_nameinstead ofx - keep naming style consistent
- avoid overwriting variables accidentally
Example
researcher_name = "Aria"
location = "Dry Sclerophyll Plot A"
day_number = 3
print("Researcher:", researcher_name)
print("Location:", location)
print("Day:", day_number)
Checkpoint
- values can be changed in one place and reflected in output
- names are readable to another student
- program still runs cleanly after edits
Chapter 3 — Remembering what matters
EXPLORER · v2 · stopping the copy-paste problem
Where things start to get annoying
Your console can now speak clearly. That’s good.
But there’s a problem hiding in plain sight.
Right now, all the important details about the mission are baked directly into the
If you wanted to change the mission location, or the system status, you’d have to hunt through the program and edit multiple lines.
That works for a tiny program. It stops working very quickly.
But there’s a problem hiding in plain sight.
Right now, all the important details about the mission are baked directly into the
print() lines.
If you wanted to change the mission location, or the system status, you’d have to hunt through the program and edit multiple lines.
That works for a tiny program. It stops working very quickly.
A simple fix
Instead of repeating the same information all over the program, we’re going to put it in one place.
We’ll give each important detail a name, store it once, and then use that name wherever we need the information.
That way:
when something changes, you change it once — and the whole console updates.
We’ll give each important detail a name, store it once, and then use that name wherever we need the information.
That way:
when something changes, you change it once — and the whole console updates.
This is called using variables
A variable is just a labelled place where Python stores information for you.
Once something has a label, you can reuse it anywhere in the program without rewriting it.
You don’t need to memorise anything fancy here. You’ll understand variables by using them.
Once something has a label, you can reuse it anywhere in the program without rewriting it.
You don’t need to memorise anything fancy here. You’ll understand variables by using them.
EXPLORER v2 (run this)
This version of the console now knows details about the mission and the system.
All the important information lives at the top. The rest of the program just uses it.
Read the comments as you go — they explain why each section exists.
All the important information lives at the top. The rest of the program just uses it.
Read the comments as you go — they explain why each section exists.
"""
EXPLORER v2 — Chapter 3
This version stores important mission and system details once,
then uses them throughout the console output.
"""
# =========================
# MISSION DETAILS
# =========================
# These describe what the mission is and where it is happening.
mission_location = "Scrubby Creek"
mission_day = 1
lead_researcher = "Student Researcher"
# =========================
# SYSTEM STATE
# =========================
# These describe the current state of the console.
system_status = "Online"
readiness_message = "Ready to receive mission data"
# =========================
# CONSOLE OUTPUT
# =========================
# The console uses the stored information to build its output.
print("=" * 44)
print(" EXPLORER CONSOLE ")
print("=" * 44)
print(f"Location: {mission_location}")
print(f"Day: {mission_day}")
print(f"Lead researcher: {lead_researcher}")
print()
print("System status:")
print(f"- {system_status}")
print(f"- {readiness_message}")
print("=" * 44)
Try changing just one thing
Change the mission location, the day number, or the researcher’s name at the top of the program.
Run the program again.
Notice how the output updates everywhere without touching the
That’s the moment variables earn their keep.
Run the program again.
Notice how the output updates everywhere without touching the
print() lines.
That’s the moment variables earn their keep.
Next time
Right now, everything you store is text or a whole number.
In the next chapter, we’ll slow down and look at different kinds of information — and why Python cares about the difference.
In the next chapter, we’ll slow down and look at different kinds of information — and why Python cares about the difference.