User Guide

134
For example:
• In the Python Shell, type the following expression and
then press Enter:
5 + 5
Using Variables
In programming terms, a variable is an area of the computer’s
memory that you give a name to. You can store information in
these variables and access it later.
To create a variable: specify a name, followed by an equals sign,
and then the value it should contain. For example:
result = 5 + 5
print(result)
Variable names must start with a letter (a–z, or A–Z). The
remaining characters in the name can be letters, numbers, or an
underscore (_). You cannot use punctuation marks or other
special characters in the names of variables, and there are
several words (such as “print”) that you cannot use as a variable
name because they are already used for something else.
To Do This
Add two numbers together Type one number followed by a +
symbol and then another number.
Subtract the second number from
the first
Type the first number followed by a
- symbol and then the second
number.
Multiply two numbers together Type one number followed by a *
symbol and then another number.
Divide the first number by the
second
Type the first number followed by a
/ symbol and then the second
number.
Divide the first number by the
second, and return a whole number
Type the first number followed by //
and then the second number.