🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Python Dictionaries: all 15 questions

Quiz: Python Dictionaries · Question 10 of 15

What does this print? (code)

What does this print?

d = {"a": 1}
print(d.pop("a"), d)
  1. A.1 {}
  2. B.a {}
  3. C.1 {'a': 1}
  4. D.An error
Answer & explanation

Correct answer: 1 {}

pop removes the key and returns its value.

Can you get the rest right without peeking?

Take the timed Quiz: Python Dictionaries quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →