ABSTRACT

In this chapter, the authors discuss the dictionary, which is a collection of pairs of key values. A dictionary in Python is an unordered collection of data values, used to store data values like a map, which, unlike other data types that hold only a single value as an element, a dictionary holds a key: value pair. A key-value is provided in the dictionary to make it more optimized. It can define a dictionary by enclosing a comma-separated list of key-value pairs in curly braces ({}). A colon (:) separates each key from its associated value. Dictionaries are changeable, meaning that we can change, add or remove items after the dictionary has been created.