Working with Numbers and Logic
Interacting with algorithms involves working with data of various sorts, but much
of the work involves numbers. In addition, you use logical values to make deci-
sions about the data you use. For example, you might need to know whether two
values are equal or whether one value is greater than another value. Python sup-
ports these number and logic value types:
»
Any whole number is an integer. For example, the value 1 is a whole number, so
it’s an integer. On the other hand, 1.0 isn’t a whole number; it has a decimal part
to it, so it’s not an integer. Integers are represented by the
int
data type. On
most platforms, you can store numbers between –9,223,372,036,854,775,808
CHAPTER 4
Do'stlaringiz bilan baham: |