Python Program to Check if Key Exists in Dictionary Using in Keyword
#Write a Python Program to Check if a Key is Already Present in a Dictionary Using in keyword my_dict = {1: 'a', 2: 'b', 3: 'c', 4: 'd'} # Using if statement and in keyword, you can check if a key is present in a dictionary if 4 in my_dict: print("Present")
Output:
Present