What are dictionaries? Dictionaries are another collection in Python.
They are different than keys:

a set which contains (key, value) pairs

For every key in a dictionary, there is a value. Unlike lists, dictionaries do not have an specific order.

Related course: Complete Python Bootcamp: Go from zero to hero in Python


You can create a dictionary with this line:
words = {}

Beware: This is just two characters different from a list.

Type the code below and run it:


words = {}
words["BMP"] = "Bitmap"
words["BTW"] = "By The Way"
words["BRB"] = "Be Right Back"

print words["BMP"]
print words["BRB"]


  1. Make a mapping from countries to country short codes
  2. Print each item (key and value)

Download answers