← 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?
- A.None
- B.0
- C.KeyError
- 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 →