Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import functools
- def getFreq(lst):
- freq = dict()
- def reducer(acc, elem):
- def reducer2(acc2, elem2):
- if elem2 not in freq.keys():
- freq[elem2] = 1
- else:
- freq[elem2] += 1
- functools.reduce(reducer2, elem, None)
- functools.reduce(reducer, lst, None)
- return freq
- print(getFreq(['aaa', 'bbb', 'aabbb']))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement