This chapter continued our discussion of arithmetic. You used variables to store values for later use. We introduced Python’s arithmetic operators and showed that you must write all expressions in straight-line form. You used the built-in function print
to display data. We created single-, double- and triple-quoted strings. You used triple-quoted strings to create multiline strings and to embed single or double quotes in strings.
You used the input
function to prompt for and get input from the user at the keyboard. We used the functions int
and float
to convert strings to numeric values. We presented Python’s comparison operators. Then, you used them in a script that read two integers from the user and compared their values using a series of if
statements.
We discussed Python’s dynamic typing and used the built-in function type
to display an object’s type. Finally, we introduced the basic descriptive statistics minimum and maximum and used them to calculate the range of a collection of values. In the next chapter, you’ll learn Python’s control statements and program development.