LEVEL 2: THE POWER OF VARIABLES 💎

WHAT IS A VARIABLE?

Now that you’ve made Python speak, it’s time to give it a memory! In the world of programming, a Variable acts like a labeled box. Imagine you have a box labeled "PlayerName." You can put any name you want inside that box, and whenever you tell Python to look at "PlayerName," it will remember exactly what you stored there.

Creating a variable in Python is incredibly easy—you simply pick a name and use the equals sign = to assign a value. For example, flower_count = 5 tells the computer to reserve a spot in its memory for a number.

MASTERY CHALLENGE

Try this: Create a variable called my_favorite_food and set it equal to a string (text in quotes). Then, create a second variable called quantity and set it to a number. Finally, print them both out!

I'VE MASTERED VARIABLES! GO TO LEVEL 3 ➔

← BACK TO LEVEL 1 🏠 HOME