Game Development Reference
In-Depth Information
Expressions
Try typing some of these math problems into the shell, pressing Enter key after each one.
2+2+2+2+2
8*6
10-5+6
2 + 2
Figure 2-2 is what the interactive shell in IDLE will look like after you type in the
instructions above.
Figure 2-2: What the IDLE window looks like after entering instructions.
These math problems are called
expressions. Computers can solve
millions of these problems in seconds.
Expressions are made up of values (the
numbers) connected by operators (the
math signs). Let's learn exactly what
values and operators are.
As you can see with the last
expression in the above example, you
can put any amount of spaces in
between the integers and these operators. (But be sure to always start at the very beginning
of the line, with no spaces in front.)
Figure 2-3: An expression is a made up of values and operators.
Numbers are a type of value. Integers are a type of number. But, even though integers are
numbers, not all numbers are integers. (For example, fractions and numbers with decimal
points like 2.5 are numbers that are not integers.)
Search WWH ::




Custom Search