mercredi 20 octobre 2021

How can I rearrange a set of values into new pattern on python and print results

so I will do my best to explain what I'm looking for, at the moment I have a 100 item list that I want to repetitively shuffle using a set pattern to first check if the pattern will eventually bring me back to where I began and 2 to print the result of each loop to a text file.

so using a 3 item list as my example [a,b,c] and the shuffle pattern [3 1 2] where the 3rd item becomes the first. the first item becomes the second and the second item becomes the 3rd on a loop would generate the following patterns

[a,b,c]

[3,1,2]

[c,a,b]

[b,c,a]

[a,b,c]

but I have a list at the moment of 100 items that I need to find every single arrangement for a few different patterns I would like to test out.

does anyone know of a way to do this in python please.

Aucun commentaire:

Enregistrer un commentaire