Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
from itertools import combinations
nums2 = [-25,-10,-7,-3,2,4,8,10]
def sum_of_3_0(list1, sum1):
print "List of possible combinations : {}".format([list(comb) for comb in combinations(list1, 3) if sum(comb) == sum1])
sum_of_3_0(nums2, 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment