Exercise 9: Dictionary

Python supports a data structure known as dictionary:  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.

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"]

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

Exercise 8: Lists
Exercise 10: Read file