Python Programming - Generators - Discussion

Discussion Forum : Generators - General Questions (Q.No. 21)
21.
How does the itertools.chain() function behave when used with generators?
It creates a chain of generators
It concatenates multiple generators into a single iterator
It interleaves values from different generators
It stops the generators after one iteration
Answer: Option
Explanation:
itertools.chain() concatenates multiple generators into a single iterator. It produces values from each generator in sequence until all generators are exhausted.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.