I would like to count sum(subsets) in the following code, how can i do this? thanks.
import itertools thelist = [0, 0, 0, 1, 1, 2, 2, 1] for L in range(5,6): for subset in itertools.combinations(thelist, L): print(f"{subset} => {sum(subset)}")For example, I would like to count where sum(subset)=6,7 etc.