In Python, lists work well for ordered items, but sometimes order is not the main concern. Sometimes you need fast access to values based on a label or a name. This is where dictionaries are useful. A dictionary stores data as pairs, linking a key to a value.
Each key acts like a unique label. Each value is the data tied to that label. Instead of looking up data by position, you look it up by name. This makes dictionaries feel more natural when structuring information.
You create a dictionary using curly braces. Keys and values are separated by colons.

Every piece of data here is simple and clear. You can see what value each position represents, eliminating any uncertainty.
NOTE:You don’t have to assign the dictionary to a variable, but it’s a common practice to do so in order to keep it accessible for later use in your code.
Another option for creating a dictionary is to use the dict() constructor. This constructor creates a dictionary from a list of key-value pairs.
To create a dictionary, we pass a list of tuples to the dict() constructor. Each tuple consists of a key as the first element and its corresponding value as the second element.

When to Use Dictionaries
Dictionaries work best when data is identified by labels rather than positions. Settings, profiles, and records all fit this pattern well. Because searches are fast and direct, dictionaries are a common choice for organizing information cleanly.
Accessing and Updating Data
To retrieve a value, you use its key. We call this bracket notation:

Dictionaries are flexible. You can change existing values or add new ones at any time.

This ability makes dictionaries particularly useful for handling data that changes during the program’s execution.
Dictionaries have methods that help you inspect their contents. You can loop through keys, values, or both.

The methods .keys() and .values() return a dictionary view that includes all the keys and values found in the dictionary.

The .get() method helps you retrieve the value for a given key. While it resembles the bracket notation we talked about earlier, its main benefit is that you can provide a default value, so you won’t run into an error if the key isn’t present.
It’s syntax is: dictionary.get(key, default).

Wrapping It Up
Dictionaries create a balance between structure and flexibility. They map names to values and keep code readable. For beginners, they introduce a new way to think about data. Instead of asking where something is (index), you ask what it is (key). That shift makes programs easier to design and easier to understand.