I'm sorry the title is very confusing because it's already kind of confusing to think about how to say it in my native language.
An example will be far more clear than I can be with sentences:
Let's say I have a list:
l = [1, 2, 3]
I want my output to look like this:
out = [ [1, 2, 3], [3, 3], [1, 5], [4, 2], [6] ]
So basically, you make this list:
[ l, [ l[0]+l[1], l[2] ], [ l[0], l[1]+l[2] ], [ l[0]+l[2], l[1] ], [ l[0]+l[1]+l[2] ] ]
I've already found a way to do this, it's an ugly function and I was wondering if there was a beautiful, pythonic way to do this. I thought about using functools.reduce() but can't wrap my head around how to do this.
Thanks in advance.