Swipe to navigate through the chapters of this book
You’ve seen that lists are useful when you want to group values into a structure and refer to each value by number. In this chapter, you learn about a data structure in which you can refer to each value by name. This type of structure is called a mapping. The only built-in mapping type in Python is the dictionary. The values in a dictionary don’t have any particular order but are stored under a key, which may be a number, a string, or even a tuple.
Please log in to get access to this content
To get access to this content you need the following product:
The dict function isn’t really a function at all. It is a class, just like list, tuple, and str.
- Dictionaries: When Indices Won’t Do
Magnus Lie Hetland
- Sequence number
- Chapter number
- Chapter 4