In this lesson, you'll learn about the dictionary object in Python.


A dictionary (of type dict) provides a fast way of looking something up. Dictionaries are often used when you want to create a mapping from keys to values without having to maintain their order. Additionally, if you want to access items instantly without having to traverse through the whole collection, dictionaries are the way to go.

A dictionary consists of zero or more key:value pairs enclosed in braces, { }. For example, you might define a “phone book” dictionary as follows:

phones = {"Alice":5551212, "Jill":5556789, "Bob":5559999}

You can see this in the example below:

Get hands-on with 1200+ tech skills courses.