🐸

The Magic Box

Python Basicspython-basics-02-the-magic-box
Reward: 50 XP
|

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 Solution
Click to expand

Here is how you store and check energy:

energy = 100
print(energy)
Advanced Tips
Want more? Click to expand

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...