Lesson 1

Introducing Dictionaries


A dictionary in python is a collection of keys and values. In the image to the side, you will see an example of one

Words on the left of the colon are called keys and the words on the right are their corresponding values.

The keys keep track of which item is which in a dictionary, and the values are what we get when we try to look an item up by a certain key. For example if we looked in this dictionary for “Make”, we would get the string “Honda”

To find a value in a dictionary, you simply need to write out the dictionary name, with the key you want to search in square brackets

If we were to write out “print(carDict[“Year”]), it would print “2002” in our Console