Python Programming - Dictionaries - Discussion

Discussion Forum : Dictionaries - General Questions (Q.No. 20)
20.
What does the dictionary.pop(key, default_value) method do?
Removes the key from the dictionary.
Returns the value for the key and removes it.
Returns the value for the key or the default value if the key is not present.
Adds a new key-value pair with the specified default value.
Answer: Option
Explanation:
The pop() method returns the value for the key or the default value if the key is not present and removes the key from the dictionary.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.