- Variables are names we attach spaces in the computer memory where we can store numbers, characters and strings
- Computer memory is like a huge filing cabinet
- Each time we put something into the cabinet, we label it so we can find it again later
- I might call it x, i or total
- Make sure the variable has a suitable name with no spaces
- Use CamelCase, no spaces or reserved words like print
x = 20
y = 40.5
z = x + y
messageA = “Hello”
messageB = “World”
messageC = messageA + messageB
Tasks
- Assign some variables using the code above
- Print out all the variables using the print() function
- Remember, you don’t need speech marks “” to print variables!
- Save and label your code
Extension
Try setting and combining different variables. What happens when you try to add text and a number?