Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
On to the code! Probably the best way to understand numeric objects and expressions is to see them in action, so let’s start up the interactive command line and try some basic but illustrative operations (see Chapter 3 for pointers if you need help starting an interactive session).
First of all, let’s exercise some basic math. In the following
interaction, we first assign two variables (a and b) to integers so we can use them later in
a larger expression. Variables are simply names—created by you or
Python—that are used to keep track of information in your program.
We’ll say more about this in the next chapter, but in Python: