Which method is used to remove a key-value pair from a dictionary in Python?
-
A
remove()
-
B
pop()
Correct answer
-
C
delete()
-
D
discard()
10 views
Explanation
The pop() method removes a key-value pair from a dictionary based on the specified key.
Doubts & discussion
Not sure why the answer is B? Ask here and get an explanation.
Ask a doubt about this MCQ