# Combinations with sum

To find all the possible combination for a given sector in a killer sudoku or in a “between 1 and 9” sudoku.

Find all combinations for a between 1 and 9 that sums to 18 with 3 cells

from itertools import combinations
print [c for c in combinations([2,3,4,5,6,7,8], 3) if sum(c) == 18]

Find all combinations in a killer for a sum of 22 in 3 cells

from itertools import combinations
print [c for c in combinations([1,2,3,4,5,6,7,8,9], 3) if sum(c) == 22]