Variables
Variables
In some programming languages, you must declare a variable before you can use it. With the term
declare, we have to define the variable’s name and data type.
DECLARE name AS string
In Python, we don’t have to declare the variables.
OUTPUT A VARIABLE
We already learned how to output a value. Let’s see now how to output a variable. Run the following
code
Age = 15
CodeName = "James Bond"
print(Age)
print(CodeName)
Open the computer game program you started writing in the previous lesson.
1. Create a variable called Score.
2. Assign the value 0 to this variable.
3. Add a command to print out the variable.