← Quiz: Iterators and Generators: all 10 questions
Quiz: Iterators and Generators · Question 2 of 10
What does this print? (code)
What does this print?
it = iter("ab")
next(it)
print(next(it))
- A.a
- B.b
- C.ab
- D.An error
Answer & explanation
Correct answer: b
The first next() returns "a", the second returns "b".
Can you get the rest right without peeking?
Take the timed Quiz: Iterators and Generators quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →