K = 10
count = 0

for i in range(10):
    for j in range(10):
        if j == i:
            continue
        for k in range(10):
            if k == i or k == j:
                continue
            if i + j + k == K:
                count += 1
                print((i, j, k))

print(count)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: