Matt Coding Tutor
A Moonlight Pixel Learning Publication
Generated from your question and organized for review.
LESSON SHEET
Student Question
Python variables are names that store values.
Think of a variable like a label on a box.
The box holds something, like a number or a word.
The label helps Python find it later.
Now let's look at a simple example.
name = "Maya"
age = 12
print(name)
print(age)
The variable name stores the text "Maya".
The variable age stores the number 12.
So when Python sees print(name), it looks inside the variable called name and prints the value inside it.
What Python is really doing
Python reads this line:
name = "Maya"
as:
“Create a name called name, and make it point to the value "Maya".”
Then Python remembers that connection.
Later, when Python sees name, it replaces it with the value stored there.
That is why print(name) prints Maya, not the word name.
Why variables matter
Variables help your program remember information.
Without variables, you would have to type the same values again and again.
They are useful when values might change, like a score, a username, a price, or someone’s age.
Common Beginner Mistake
Many beginners accidentally put quotes around a variable name when they want the value.
name = "Maya"
print("name")
This prints the word name, because quotes mean “use this exact text.”
To print the value inside the variable, leave off the quotes:
print(name)
A simple way to remember it is:
Quotes mean text.
No quotes mean variable name.
My Notes
Write one thing that helped this lesson make sense to you.
Lesson Complete
Matt's Reminder
Learning Python is not about memorizing every command. It is about understanding how to solve problems one step at a time. Every lesson you complete makes the next lesson easier.