Program to Check if Key exists in Dictionary Python || Dictionaries || Python
In this we are going to see a basic program to check if key exists in dictionary or not in Python Programming Language.



dict1 = {1: 'a',2: 'b',3: 'c',4: 'd',5: 'e'}
key = int(input("Enter the key to check: "))
if key in dict1:
    print("Key exists")
else:
    print("Key doesn't exist")

# Coded By DHIRAJ SHELKE


#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post