Python - Intro to Dictionaries
Code Life
By Pierre Marsaa
What is a Dictionary?
A dictionary in Python is a collection of key-value pairs. Think of it like a real dictionary where you look up a word (the key) to find its definition (the value).
Dictionaries are created using curly braces {} with keys and values separated by colons :
↗️
Loading editor...
↶
↷
In this example:
- "name", "type", and "level" are the keys
- "Aquachu", "water", and 15 are the values
- Each key is associated with exactly one value
Verify