<AptiCode/>

Question 520: What is the correct way to check if a key is present in a dictionary?my_dict = {'name': 'John', 'age': 25} key_to_check = 'age'

tcs
wipro
infosys
general
aptitude
tricky-questions
python-programming

The correct way to check if a key is present in a dictionary is to use theinkeyword directly on the dictionary.