# dictionaries are hash tables, key:value pairs
dict = {'Adam': ['[email protected]', 2445055],
        'Bard': '[email protected]'}

dict                    # {'Adam': ['[email protected]', 2445055], 'Bard': '[email protected]'}
dict['Adam']            # ['[email protected]', 2445055]
dict['Adam'][1]         # 2445055

# update value
dict['Bard'] = '[email protected]'
dict                    # {'Adam': ['[email protected]', 2445055], 'Bard': '[email protected]'}

# add key:value pair
dict['Cole'] = '[email protected]'
dict                    # {'Cole': '[email protected]', 'Adam': ['[email protected]', 2445055], 'Bard': '[email protected]'}

# remove key:value pair
del dict['Cole']        # {'Adam': ['[email protected]', 2445055], 'Bard': '[email protected]'}

'Cole' in dict          # False
'Adam' in dict          # True

# create dictionary from a list of tuples
dict_list_tuples = dict([(1, "x"), (2, "y"), (3, "z")])
dict_list_tuples        # {1: 'x', 2: 'y', 3: 'z'}

'''
Michael Sjoeberg
2018-11-05
https://github.com/michaelsjoeberg/python-playground/blob/master/basics/dictionaries.py
'''