Python Programming - Generators - Discussion

Discussion Forum : Generators - General Questions (Q.No. 66)
66.
What is the purpose of the itertools.accumulate() function when used with generators?
It generates the cumulative sum of elements in the generator
It filters elements based on a specified condition
It stops the generator after one iteration
It interleaves values from different generators
Answer: Option
Explanation:
itertools.accumulate() generates the cumulative sum of elements in the generator, creating an iterator that yields the accumulated results.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.