← Quiz: Iterators and Generators: all 10 questions
Quiz: Iterators and Generators · Question 8 of 10
Which two methods make a class an iterator?
Which two methods make a class an iterator?
- A.init and len
- B.getitem and len
- C.call and str
- D.iter and next
Answer & explanation
Correct answer: iter and next
These two methods are the iterator protocol.
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 →