Created
October 21, 2017 14:48
-
-
Save bondnotanymore/91fe3fdbce995795d9d4b51820e20211 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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