I have a list of lists, and am trying to get the sum of all combinations.
For example: [[1,2,3],[2,3],[4,5]]
would produce (1+2+4),(1+2+5),(1+3+4),(1+3+5), (2+2+4)
etc.
I can't seem to find a way to do this- any help? Note that I know how to produce the sums, the issue is just with iterating over all combinations.
I had the idea of using zip() but this would sum everything in place, and then we could rotate the lists to cover all combinations, would this work? It seems very complicated. Or is there a simpler way to iterate using a loop?