July 2020
Beginner to intermediate
248 pages
6h 58m
English
Dictionaries (http://mng.bz/5aAz), or dicts, are one of Python’s most powerful and important data structures. You may recognize them from other programming languages, in which they can be known as “hashes,” “associative arrays,” “hash maps,” or “hash tables.”
In a dict, we don’t enter individual elements, as in a list or tuple. Rather, we enter pairs of data, with the first item known as the key and the second item known as the value. Whereas the index in a string, list, or tuple is always an integer, and always starts with 0, dict keys can come from a wide variety of Python types--typically integers or strings.
This seemingly small difference, that we can use arbitrary keys to locate our values, rather than using integer ...