Write a python program that takes a value and checks whether the given value is part of given dictionary or not. If it is, it should print the corresponding key otherwise print an error message.
Answers
Answered by
2
Answer:
Explanation:
Here is source code of the Python Program to check if a given key exists in a dictionary or not. The program output is also shown below. d={'A':1,'B':2,'C':3} key=raw_input("Enter key to check:") if key in d. keys(): print("Key is present and value of the key is:") print(d[key]) else: print("Key isn't present!")
Answered by
1
Explanation:
here is sources code of the python program to check if a given key exists in a dictionary or not.
Similar questions