Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from itertools import combinations
- def filler(A, l):
- n = len(l)
- result = list()
- for i in range(1, n+1):
- for comb in combinations(l, i):
- if (sum(comb) == A):
- result.append(comb)
- return result if len(result) > 0 else "None"
- # Example:
- print(filler(10, [1, 2, 3, 4]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement