← Quiz: The collections Module: all 10 questions
Quiz: The collections Module · Question 1 of 10
What does this print? (code)
What does this print?
from collections import Counter
print(Counter("banana").most_common(1))
- A.[('n', 2)]
- B.[('a', 3)]
- C.[('b', 1)]
- D.{'a': 3}
Answer & explanation
Correct answer: [('a', 3)]
"a" appears 3 times, more than any other letter.
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 →