So, if you use this, you will get possible list combinations
stuff = [1, 2, 3]
for L in range(0, len(stuff)+1):
for subset in itertools.combinations(stuff, L):
print(subset)
And the result
()
(1)
(2)
(3)
(1, 2)
(1, 3)
(2, 3)
(1, 2, 3)
Is there any way to change this so that the result is
(0, 0, 0)
(1, 0, 0)
(0, 2, 0)
(0, 0, 3)
(1, 2, 0)
(1, 0, 3)
(0, 2, 3)
(1, 2, 3)
or other code that will do this?
source
share