← Python for Beginners
0 of 27 lessons done0%

Basics · Lesson 3 of 27

Variables

A variable is a name that stores a value, so you can use it later.

name = "Riya"
age = 21
print(name)
print(age)

The = sign means "store the value on the right in the name on the left". It is not "equals" like in maths.

You can change a variable any time:

score = 10
score = score + 5
print(score)   # 15

Naming rules

  • Use letters, numbers and _. No spaces: first_name, not first name.
  • A name cannot start with a number: 2nd is wrong, second is fine.
  • Names are case-sensitive: age and Age are different variables.

Your task

Create a variable name with the value "Aman" and a variable age with the value 20.

Then print them in one line using commas, so the output is:

Aman is 20 years old