stasio14
New Coder
How to make program in python to add every item to each other, to get all of possibilities.
Ex. I have a list [CODE lang="python" title="List 1"][0,1,5,6][/CODE] and I want the output to look like this: [CODE lang="python" title="List 2"][0,1,5,6,50,51,55,56][/CODE]
I tried to make double loop, to add items, but it doesn't solve the problem for 3 or more elements. In above case I tried to use sum (), but in more complex cases it's totally useless. And I'm now stuck in that moment.
Thanks
Ex. I have a list [CODE lang="python" title="List 1"][0,1,5,6][/CODE] and I want the output to look like this: [CODE lang="python" title="List 2"][0,1,5,6,50,51,55,56][/CODE]
I tried to make double loop, to add items, but it doesn't solve the problem for 3 or more elements. In above case I tried to use sum (), but in more complex cases it's totally useless. And I'm now stuck in that moment.
Thanks
Last edited: