← Quiz: Modules and Libraries: all 14 questions
Quiz: Modules and Libraries · Question 2 of 14
What does this print? (code)
What does this print?
from collections import Counter
print(Counter("aabbbc")["b"])
- A.2
- B.3
- C.1
- D.b
Answer & explanation
Correct answer: 3
Counter counts each character; "b" appears 3 times.
Can you get the rest right without peeking?
Take the timed Quiz: Modules and Libraries quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →