Set s
e
t
Y
e
s
Unordered collection of unique objects,
such as {"a","b"}
Integers, Floating Point, and Complex Numbers
The integers and floating point numbers are the simplest
of data types:
Integers: Whole numbers without decimal points
Floating point: Numbers with decimal points or exponents (such as
10e5, which indicates 10 to the fifth power)
Python can perform advanced calculations, so it is used
heavily in data science, and many features are built into
the language and can be easily added with modules. For
our purposes, though, the basic building blocks will
suffice. Python has a simple set of built-in operators for
working with numbers, much like the operators on a
regular calculator. Table 3-3 lists Python’s numeric
operators.
Table 3-3 Python’s Numeric Operators
OperatorDescriptionExampleEvaluates to
+ Adds two expressions together 5 +
5
1
0
- Subtracts one expression from another 35 -
15
2
0
* Multiplies two expressions 10 *
10
1
0
0
/ Divides one expression by another 20
/ 5
4
/
/
Performs integer division (leaving off the
remainder)
30
// 7
4