check if a key exists in a dictionary and return its value if true code example
Example 1: python check if value exists in any key
>>> d = {'1': 'one', '3': 'three', '2': 'two', '5': 'five', '4': 'four'}
>>> 'one' in d.values()
True
Example 2: contanskey in python
d = {
"a": 1,
"b": 2
}
# To check if key is there in the dictionary
if "a" in d:
print("Found")