← Data Structures

Dictionaries

Indexes are useful ways of finding data.

But sometimes, we want a clearer way of labelling information.

To do this, we can take each of our “values” (datapoints), and assign it a nametag called a “key”.

The resultant “key-value pairs” can then be combined into a single structure, which we call a dictionary.

For example:

{“name”: “Steve”, “age”: 74, “hypertension”: True}

Notice how much information can be packed into a few key-value pairs. Also, note how different data types can be contained in a single dictionary.

We’re almost done with data structures now.

All that’s left is to cover sets. I think you’ll find it pretty intuitive.