Dictionaries

A dictionary is a common data structure in Python. It is used to store unidirectional mappings from keys to values. For example, if we wanted to create a dictionary that stored a list of patient names and their corresponding room numbers, we could use the following code:

rooms = {
'Smith': '141-A',
'Davis': '142',
'Williams': '144',
'Johnson': '145-B'
}

Let's talk about the preceding code snippet in more detail: