🎙 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 2 of 15

What does {"x": 1}.get("y", 0) return?

What does {"x": 1}.get("y", 0) return?

  1. A.None
  2. B.0
  3. C.KeyError
  4. D."y"
Answer & explanation

Correct answer: 0

get returns the default (0) when the key is missing.

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 →