Apr-19-2020, 09:12 PM
(This post was last modified: Apr-19-2020, 09:12 PM by deanhystad.)
How to make list of all unique combinations of [0..6, 0..7, 0..8]
things = [] for x in range(0, 7): for y in range(x, 8): for z in range(y, 9): things.append((x, y, z))Same list but no repetitions allowed:
things = [] for x in range(0, 7): for y in range(x+1, 8): for z in range(y+1, 9): things.append((x, y, z))This last one as a comprehension
things = [(x,y,z) for x in range(0,7) for y in range(x+1,8) for z in range(y+1,9)]