# basics variables

Data Types: dict

A dictionary (dict) stores values in key-value pairs, inside curly braces { }. Instead of looking things up by position (like a list), you look them up by name:

ages = {"Sam": 10, "Zoe": 12}
print(ages)
print(type(ages))

prints:

{'Sam': 10, 'Zoe': 12}
<class 'dict'>

Your turn: create a dictionary called scores with exactly two entries: "Sam" mapped to 10, and "Zoe" mapped to 12 (in that order). Print scores, then print type(scores).

💡 need a hint?

pyb-var-types-dict.py
loading...