19. Create a dictionary named D with three entries, for keys ‘a’, ‘b’ and V . What happens if you try to index a nonexistent key (D[‘d’]) ? What does Python do if you try to assign to a nonexistent key d (e.g., D[‘d’]=’spam’) ?

# Code
D = {‘a’:1, ‘b’:2, ‘c’:3}
If we try to call with a non-existing key, python will raise an error
If we try to assign to a nonexistent key, a new key:value pair will be added to the dictionary
e.g.
print(D[‘d’]) # raises error
D[‘d’] = ‘spam’
print(D) # {‘a’: 1, ‘b’: 2, ‘c’: 3, ‘d’: ‘spam’}