Jul-27-2018, 05:51 AM
I know how to use itertools for permutations in the normal way.
[a, b]
[a, c]
[b, a] etc...
What if I want each element in the permutation to have a separate list?
something like:
[a, c]
[a, d]
[a, e]
[b, c]
[b, d]
[b, e]
Thanks
permutations = (['a', 'b', 'c'], 2)would give
[a, b]
[a, c]
[b, a] etc...
What if I want each element in the permutation to have a separate list?
something like:
permutations = (['a', 'b'], ['c', 'd', 'e'] 2)which would give
[a, c]
[a, d]
[a, e]
[b, c]
[b, d]
[b, e]
Thanks