Python Programming - Generators - Discussion

Discussion Forum : Generators - General Questions (Q.No. 20)
20.
How does the itertools.cycle() function behave when used with a generator?
It creates an infinite sequence of repeated values from the generator
It generates a single iteration from the generator
It stops the generator after one complete cycle
It shuffles the values produced by the generator
Answer: Option
Explanation:
itertools.cycle() creates an infinite sequence of repeated values. When used with a generator, it continuously cycles through the values produced by the generator.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.