Guest User

Untitled

a guest
Jun 19th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. import itertools
  2.  
  3. my_set = [3, 4, 9, 14, 15, 19, 28, 37, 47, 50, 54, 56, 59, 61, 70, 73, 78, 81,
  4. 92, 95, 97, 99]
  5.  
  6. def greplin_condition(S):
  7. max_item = max(S)
  8. S.remove(max_item)
  9. if sum(S) == max_item:
  10. return True
  11. else:
  12. return False
  13.  
  14. a = 0
  15. for i in range(3, len(my_set)):
  16. for s in itertools.combinations(my_set, i):
  17. if greplin_condition(list(s)):
  18. a = a + 1
  19.  
  20. print a
Add Comment
Please, Sign In to add comment