Python Programming - Dictionaries - Discussion

Discussion Forum : Dictionaries - General Questions (Q.No. 34)
34.
How do you check if a key exists in a dictionary without raising an error if the key is not present?
if dictionary.contains(key):
if key.exists_in(dictionary):
if key in dictionary:
if dictionary.has_key(key):
Answer: Option
Explanation:
The in keyword is used to check if a key exists in a dictionary.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.