Python ยท Lesson 2 of 5

๐Ÿ“ฆ Variables

Store numbers and words in named boxes.

A variable is a box with a name. You put a value in it with =, and use the name later.

name = "Aarav"
age = 11
print(name, "is", age, "years old")
OUTPUTAarav is 11 years old

You can change what is in the box. The newest value wins.

score = 10
score = score + 5
print(score)
OUTPUT15

๐Ÿ’ก Variable names cannot have spaces. Use my_score, not my score.

โœ๏ธ Your turn

Open this example in the playground, change it and run it.

โ–ถ Try it yourself

๐Ÿง  Quick quiz

After x = 4 and then x = x * 2, what is x?