Skip to content

Instantly share code, notes, and snippets.

@bondnotanymore
Created October 21, 2017 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bondnotanymore/91fe3fdbce995795d9d4b51820e20211 to your computer and use it in GitHub Desktop.
Save bondnotanymore/91fe3fdbce995795d9d4b51820e20211 to your computer and use it in GitHub Desktop.
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