6.1.3 Data Types

In a computer program, every piece of data, compound or atomic, has a data type. For one last moment, let us recall that data in a computer is, at a low level of abstraction that we don’t usually worry about, made up of binary 0’s and 1’s (we call such numbers bits). The data type of a piece of data tells the computer how to interpret those bits. For example, one can interpret the same sequence of 0’s and 1’s as a character (or letter) from your keyboard, or as a whole or fractional number. The computer needs to know which interpretation to choose, so that’s why Python and most other programming languages have a notion of data types.

Atomic Data Types

In this section, we describe the most commonly used atomic data types in Python.

Compound Data Types

In this section, we briefly describe some of the standard compound data types built into Python. However, we will save the details of most of these until later chapters.