Variables
You can think of variables as boxes in which you can store a value and use it later. Variables are the memory for your program.
We can perform the following operations with variables:
- Create a variable with a chosen name.
- Store or overwrite a value in the variable.
- Retrieve (use) the value of the variable.
For example:
date = "11.2.2024"
print(date)Will output:
11.2.2024In the example, we created a variable date in which we stored the value “11.2.2024”. We then used this value in the print command to print its value.
Instructions
Create a variable name and store the value "John" in it.
On the next line, create a variable surname and store the value "Doe" in it.
On the next line, print the value of the name variable using the print command.
On the next line, print the value of the surname variable using the print command.
Start programming for free
5/10