What is a Variable?
A variable is a way to store information in a program.
You can think of a variable as a label attached to a value.
Real-world example:
If you write your name on a sticky note and put it on a box,
the name is the variable and what’s inside the box is the value.
Creating a Variable in Python
In Python, you create a variable by using the equals sign =.
This tells Python:
- Create a variable called
name
- Store the text
"Cienna" inside it
Using Variables with print()
You can use print() to display what is stored inside a variable.
name = "Cienna"
print(name)
Python will display:
Important Rules
- Variable names cannot have spaces
- They should start with a letter
- Python is case-sensitive (
Name ≠ name)
Variables Challenge
Your task is to:
- Create a variable called name
- Store your name as text
- Print the variable
Student Name:
✅ Correct! Well done.
❌ Check your variable and try again.