← Quiz: itertools and functools: all 10 questions
Quiz: itertools and functools · Question 9 of 10
Why should count() or cycle() always be combined with a limit like islice?
Why should count() or cycle() always be combined with a limit like islice?
- A.They return lists that are too big
- B.They produce values forever
- C.They only work inside islice
- D.They raise StopIteration immediately
Answer & explanation
Correct answer: They produce values forever
Without a limit, looping over them never ends.
Can you get the rest right without peeking?
Take the timed Quiz: itertools and functools quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →