Ajax-loader-large-white
Advanced Topics in Python
Iterators for Dictionaries

Let's start with iterating over a dictionary. Recall that a dictionary is just a collection of keys and values.

d = {
    "Name": "Guido",
    "Age": 56,
    "BDFL": True
}
print d.items()
# => [('BDFL', True), ('Age', 56), ('Name', 'Guido')]

Note that the items() function doesn't return key/value pairs in any specific order. (For more on this, see the Hint.)

Instructions
  1. Create your own Python dictionary, my_dict, in the editor to the right with two or three key/value pairs.
  2. Then, print the result of calling the my_dict.items().
script.py