1) What do I need to do?
π― Your mission: Hero profile card
Make 3 variables:
hero_name β a string β’ age β an integer β’ height β a float
Then print a sentence that uses all three.
2) What do I need to know?
Variables are labelled boxes
A variable is like a box with a label. You put something inside so you can use it later.
hero = "Blaze" makes a box called hero and puts the word Blaze inside. The = means "put into", not "equals".
To use what's inside, just write the box's name without quotes: print(hero).
π§° Your toolkit for this mission
Everything you need to know to finish this lesson on your own:
Variable
A labelled box that stores a value so you can use it later.
How to write it: Write name = value. The name goes on the left, the = puts the value inside.
hero_name = "Blaze"
Naming rules
Variable names can't have spaces or start with a number.
How to write it: Use lowercase letters and _ between words, like hero_name. No quotes around the name!
power_level = 9
String (str)
Text. Always inside quotes.
How to write it: Put quotes around it: "Blaze". Even "12" in quotes is text, not a number.
city = "Metro City"
Integer (int)
A whole number with no decimal point β like 3, 10, 0 or -5.
How to write it: Type the number with no quotes and no dot.
age = 10
Float
A number with a decimal point β like 1.5, 3.14 or 0.5.
How to write it: Type the number with a dot in it and no quotes. 1.0 is a float too!
height = 1.45
Printing variables
Show what's inside the box.
How to write it: Put the variable name in print() without quotes. Join things with commas: print("Age:", age).
print("I am", hero_name)Changing a variable
You can put a new value in the box any time.
How to write it: Use the name on both sides: energy = energy + 25 means "take energy, add 25, store it back".
energy = 50 energy = energy + 25 print(energy) # 75
Think about it
Look at this code. What happens next, and why? Say it in your own words.
hero = "Bolt" print(hero)
Watch & explore βΆ
Power-up: Variables are labelled boxes
See it happen
1 / 3hero = "Blaze"
Imagine a labelled locker. The name hero holds the word Blaze.
3) Run the code & terminal output
Press βΆ RUN and your program's messages appear here!


Captain Py
Our next adventure is yours to create.
