Definition

Dictionaries

Definition

🙋 Need help? Ask an expert now!

Dictionaries in Python

Dictionaries tend to be one of the most useful data structures in python. The true definition of a dictionary is:

A dictionary is a collection which is unordered, changeable and indexed. In Python dictionaries are written with curly brackets, and they have keys and values.

A dictionary is the same as a hash table, which allows us to look up values based on a key.

                        
# Declare the dictionary thisdict = { "brand": "Ford", "model": "Mustang", "year": 1964 } # print out the brand print(thisdict["brand"]) #prints out Ford

In the next slide we will explore more on how to create a dictionary and use it in our code.

Edit Me on GitHub!