Problem: Given a list of 3 numbers [4, 8, 15]
generate a list of all possible arrangements of the numbers.
That's 3*3*3 = 27
unique entries from what I can gather. Something like:
4,4,4
4,4,8
4,4,15
4,8,4
4,8,8
4,8,15
4,15,4
4,15,8
4,15,15
...
I tried using itertools.permutations
and itertools.combinations
but I can't get all 27 values.
list(itertools.permutations([4,8,15],3))
for example only prints 6 values:
[(4, 8, 15), (4, 15, 8), (8, 4, 15), (8, 15, 4), (15, 4, 8), (15, 8, 4)]
Is there something that's available out of the box or is this more of a "roll your own" problem?