Python Programming - Generators - Discussion

Discussion Forum : Generators - General Questions (Q.No. 60)
60.
What is the purpose of the itertools.compress() function when used with generators?
It compresses the generator into a ZIP file
It filters elements based on a boolean mask
It stops the generator after one iteration
It interleaves values from different generators
Answer: Option
Explanation:
itertools.compress() filters elements from the generator based on a boolean mask, which is provided as the second iterable argument.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.