Summary
In this chapter, you learned about dictionaries, how to create an empty dictionary, adding items to the dictionary, and accessing and deleting values from a dictionary. In order to find the number of items in a dictionary, we used the len()
function. There are other useful functions, such as max()
and min()
to find the maximum and minimum values in a dictionary, respectively. In dictionary methods you learned different methods, such as copy()
, keys()
, and items()
. By using items()
, we can iterate through a dictionary. In the end, you learned two memory-saving methods: iteritems()
and iterkeys()
.