Advertisement
STANAANDREY

Untitled

Jan 19th, 2023
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. import functools
  2.  
  3.  
  4. def subset(s, f):
  5. ans = set()
  6. def reduer(acc, elem):
  7. if f(elem):
  8. ans.add(elem)
  9. functools.reduce(reduer, s, None)
  10. return ans
  11.  
  12. print(subset({1, 2, 3, 4, 5, 6, 7, 81}, lambda x: x & 1))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement