1. Home
  2. Data Science
  3. Python
  4. Which method is used to remove a key-value pair from a…

Added 4 May 2024

Which method is used to remove a key-value pair from a dictionary in Python?

  1. remove()
  2. pop() Correct answer
  3. delete()
  4. discard()

Correct answer

B. pop()

10 views

MCQSEXAM

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

Shown after review. No links please.

More Python MCQs

Practise all Python MCQs

Similar MCQs