from itertools import permutations a=permutations(['1','2','3'],3) for i in a: print(i)
Using the
('1', '2', '3') ('1', '3', '2') ('2', '1', '3') ('2', '3', '1') ('3', '1', '2') ('3', '2', '1')
That's what I got.
Is there a way to save those results as an array or dictionary?
I'm sorry if it's too basic
python
from itertools import permutations
a = permutations(['1','2','3'],3)
arr = []
for i in a:
arr.append(i)
print(arr)
from itertools import permutations
a = permutations(['1','2','3'],3)
my_list = list(a)
print(my_list)
© 2024 OneMinuteCode. All rights reserved.