Python Programming - Generators - Discussion
Discussion Forum : Generators - General Questions (Q.No. 83)
83.
How does the
itertools.groupby()
function differ from collections.Counter()
when used with generators?
Answer: Option
Explanation:
itertools.groupby()
groups consecutive elements based on a key function, creating subgroups. collections.Counter()
counts the occurrences of each element in the entire iterable.
Discussion:
Be the first person to comment on this question !
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers