Dictionaries
This lesson highlights the key features of the dictionary data structure.
We'll cover the following
Structure #
Compared to a list or tuple, a dictionary has a slightly more complex structure.
When we think of a dictionary, what pops up is the image of a vast book containing words with their meanings.
In simpler terms, information is stored in pairs of words and meanings. Python’s dictionary data structure follows the same structure.
A dictionary stores key-value pairs, where each unique key is an index which holds the value associated with it.
Dictionaries are unordered because the entries are not stored in a linear structure.
In Python, we must put the dictionary’s content inside curly brackets, {}
:
Get hands-on with 1200+ tech skills courses.