← Quiz: The collections Module: all 10 questions
Quiz: The collections Module · Question 2 of 10
What does Counter(["x"])["y"] return?
What does Counter(["x"])["y"] return?
- A.None
- B.KeyError
- C.0
- D.1
Answer & explanation
Correct answer: 0
A Counter returns 0 for missing items instead of raising KeyError.
Can you get the rest right without peeking?
Take the timed Quiz: The collections Module quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →