Python includes a rich selection of built-in collection types which are often completely sufficient for even quite intricate programs without resorting to defining our own data structures. We'll give an overview of some of these fundamental collection types now – enough to allow us to write some interesting code – although we'll be revisiting each of these collection types, together with a few additional ones, in later chapters.
Let's start with these types:
- str – immutable strings of Unicode code points
- bytes – immutable strings of bytes
- list – mutable sequences of objects
- dict – mutable mappings from keys to values
Along the way, we'll also cover Python's for-loops.