Skip to content

Check if a key exists in a dictionary

dictionary = {'class': 'X', 'age': 16, 'score': 88, 'name': 'Anand', 'sex': 'Male'}

print ('name' in dictionary)


print ('address' in dictionary)

See also  How to take fast input in Python?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.