I am trying the below code to find missing keys in dictionary. It should function like if the user tries to access a missing key, an error need to popped indicating missing keys.
# missing value error
# initializing Dictionary
d = { 'a' : 1 , 'b' : 2 }
# trying to output value of absent key
print ("The value associated with 'c' is : ")
print (d['c'])
getting below error
Traceback (most recent call last):
File "46a9aac96614587f5b794e451a8f4f5f.py", line 9, in
print (d['c'])
KeyError: 'c'