Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import functools
- def my_filter(f, d):
- ans = dict()
- def red_funct(prev, curr):
- if f(d[curr]):
- ans[curr] = d[curr]
- functools.reduce(red_funct, d, None)
- return ans
- d = {'a': 2, 'c': 33, 'b': 3, 'asd': 11}
- print(my_filter(lambda e: e >= 5, d))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement