from itertools import combinations K = 10 arr = [1, 2, 3, 5, 7, 9] count = 0 for combo in combinations(arr,2): if sum(combo) == K: count += 1 print(count)
To embed this project on your website, copy the following code and paste it into your website's HTML: