What are dictionaries?
Dictionaries are data structures that store key:value pairs.
The key is the thing that you use to find an item in a dictionary.
The value is the item that is stored under that key.
When should I use them?
Dictionaries should be used where you need to store data in a data structure and access it by it’s name.
Dictionaries are un-ordered, so that order that you put an item in a dictionary is not necessarily the order that your item is stored in. Other other words if you need to maintain data order, use a list instead.
To use Python Live view Website - http://pythontutor.com/live.html#mode=edit
Here are a few live script examples to have a play with to see what Dictionaries could be useful for.
https://trinket.io/embed/python/911d5853cf
https://trinket.io/embed/python/d776e4ce2e
https://trinket.io/embed/python/0a2d1fb7dc
Challenges
Have a go at completing all the challenges from the Challenges worksheet - I have also included a cheat sheet to give some guidance.
Use the Python console to edit / make your own program