The Magic Box
Hoppy finds a glowing blue box. He realizes he can store energy inside it to use later.
In Python, we call these boxes Variables. You give the box a name, and put a value inside it.
How to use it
energy = 10
This means: "Create a box named energy, and put the number 10 inside it."
Your Mission
1
Store Energy
Create a variable named energy and set it to 100.
2
Check it
Print the energy variable to see what's inside.
No Quotes
When you print a variable, do NOT use quotes!
Correct: print(energy) (prints 100)
Wrong: print("energy") (prints the word "energy")
Suggested SolutionClick to expandClick to collapse
Here is how you store and check energy:
energy = 100 print(energy)
Advanced TipsWant more? Click to expandClick to collapse
Variables are like sticky notes. You can stick a new note on the same box to change its value!
score = 10 print(score) score = 20 # Now it's 20! print(score)
pymain.py
Loading...
Terminal
Terminal
Ready to run...