Look things up by name
A dictionary stores labelled values: keys and values. Instead of a position, you ask for a name.
student = {"name": "Ada", "age": 36}
print(student["name"]) # Ada
student["city"] = "London" # add a new pair
print(student.get("email")) # None — no crash when the key is missing
Use student["key"] when the key must exist, and .get("key") when it might not.
Looping through a dictionary
prices = {"apple": 0.5, "bread": 3.2}
for item, price in prices.items():
print(f"{item} costs {price}")
.keys(), .values() and .items() are the three you will reach for. Dicts remember insertion order in modern Python, but treat them as lookups rather than sequences.
Sets: unique values
A set throws duplicates away and answers "is this in here?" very quickly.
votes = ["a", "b", "a", "c", "b"]
print(set(votes)) # {'a', 'b', 'c'}
print(len(set(votes))) # 3