Python Programming - Dictionaries - Discussion

Discussion Forum : Dictionaries - General Questions (Q.No. 44)
44.
How do you check if a key exists in a dictionary using the get() method?
if key.get(dictionary):
if key.exists_in(dictionary.get()):
if dictionary.get(key) is not None:
if key in dictionary.get():
Answer: Option
Explanation:
The get() method returns None if the key is not present, so checking for is not None verifies key existence.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.