Python Programming - Tricky Questions - Discussion
Discussion Forum : Tricky Questions - General Questions (Q.No. 4)
4.
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'
Answer: Option
Explanation:
The correct way to check if a key is present in a dictionary is to use the
in
keyword directly on the dictionary.
Discussion:
Be the first person to comment on this question !
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers