for a in range(10):
    for b in range(10):
        for c in range(10):
            if a + b + c <= 20:
                for d in range(10):
                    if 2 < a + b + c + d <= 20:
                        for e in range(10):
                            if 10 < a + b + c + d + e <= 20:
                                f = 20 - (a + b + c + d + e)
result.append(''.join(map(str, [a, b, c, d, e, f])))
A nice way to find all combinations that give a sum of N?