How not to create duplicates in the first place instead of resorting to sorting and sets?
I've been trying to do one of the challenges of John Wells. (pool rotation) The question: In a list of 1 to 15, find all the sums that give 61, such that all numbers picked until the last one should mske it possible for you to have the same sum with the remaining numbers in the list, before you pick the last one. So if you had 5 numbers and if your target sum were 8, for the combo (1, 3, 4), order (1, 3) would have been a no no, and (1, 4) a yes, because, with (1, 4) you'd have (5, 3) remaining, making the sum still possible. I cannot quite tell where I'm getting the duplicates from(uncomment fstring to see). I think it's the for j in pows(A) bit that causes the problem: all combos for j in A = original ball list minus the last ball might have common elements with all combos in the next j. But maybe it's the function itself? Any help appreciated. Thanks. https://code.sololearn.com/cbtdw3MYdohf/?ref=ap