Here is the code to find the combinations in the array.
n = int(input()) arr = [ int(input()) for i in range(n) ] teaMin = int(input()) sm = sum(arr) sums = set() sums.add(0) # Находим комбинации for item in arr: for k in range(sm, min(arr) - 1, -1): if (k - item) in sums: sums.add(k) print(sums) How to make it so that it finds a combination until a number is found that is divided into the teaMin variable without a remainder?
Let's say
[2,3,5]
The output should be a list:
[2,3,5,7,8,10,12,13,15 ... 32]
Tried through while, but could not figure out how to implement this task