given a list of integers , write a program to print the count of all possible unique combinations of numbers whose sum is equal to k.
from itertools import combinations
nums = [int(x) for x in input().split()]
k = int(input())
count = 0
for i in range(1, len(nums)+1):
for c in combinations(nums, i):
if sum(c) == k:
count += 1
print(count)
Comments
Leave a comment