Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Dictionary basics
4. Accessing dictionary elements
Dictionaries in loops and conditional statements
Dictionaries in functions


Good! To access a dictionary element, we can use its key within square brackets:

phonebook = {'Mary': '8349374', 'Anne': '7439834', 'John': '3472983'}
phonebook['Anne'] # returns '7439834'

This works just like it does in lists. The only difference is that you need to provide a key, not an index.

Remember: dictionaries contain unordered data.


Print the name of the Windows operating system released in 2012.

Stuck? Here's a hint!

Use square brackets with the key (year) inside.