DPython for KidsModule 3 · Lesson 3.1
LESSON 3.1 · 35 MINUTES

Variables as Storage Boxes

A variable is a labelled storage box your program can use again.

Discover

  • Names can store text or numbers.
  • Variable names should be meaningful.
  • Changing a stored value changes later output.

Try, explain and change

Try: Create a fictional language tracker: store “Python” in language and 3 in lessons, then print “Python 3”. Use both variables in the print call.

Change: Increase lessons to 4. What changed in the output?

SAFE PYTHON RUNNER

Try the challenge

No files · no network · safe lesson commands only

Create a fictional language tracker: store “Python” in language and 3 in lessons, then print “Python 3”. Use both variables in the print call.

Target output
Python 3
Match the lines and order. Your code must use the lesson concept.

The runner supports this pathway’s controlled Python concepts while blocking packages, files, networks and system commands.

Output
Your output will appear here.
DEBUG DETECTIVE

Find the bug

favourite language = "Python"
print(favourite language)
Show debugging clue

Variable names cannot contain spaces; try favourite_language.

QUICK CHECK

Which is a valid variable name?

my score

Not this time. Review Discover and try again.

my_score

Correct — well reasoned.

3score

Not this time. Review Discover and try again.

Create and reflect

Create: Make a character profile with a name, power and score.

Reflect: How do meaningful variable names help a programmer?

Stretch practice · self check

Add a goal variable with a value of 5 and print the number of lessons still needed.

Edit and run your code again to explore this variation. It does not change lesson completion.