I am trying to loop thrue a list in python of integers, finding all uniqe combinations but if one element has been used from the list to create a combination the element can not be used again.
import itertools
import collections
list = [1, 3, 6, 8, 10, 13, 18, 25, 40, 60]
result_comb = []
result_val = []
for L in range(len(list) + 1):
for subset in itertools.combinations(list, L):
result_comb.append(subset)
result_val.append(sum(subset))
Here i get the combinations and its values, but the same elements has been used alot of times.