thank you, Nilamo.
I changed it like this with your suggestion. but I couldn't get the result. I am a new learner, what am I doing wrong here? please
I changed it like this with your suggestion. but I couldn't get the result. I am a new learner, what am I doing wrong here? please
import itertools from collections import Counter thelist = [0, 0, 0, 1, 1, 2] for L in range(5,6): for subset in itertools.combinations(thelist, L): print(f"{subset} => {sum(subset)}") totals = Counter() totals[sum(subset)] += 1 totals