mardi 15 août 2017

Generate more random combination with a list of string

I created a variable list like this : Code = ["RIGHT_ARROW","DOWN_ARROW","LEFT_ARROW","UP_ARROW"]

I would like to generate more combination of my list like this :

newCode = ["RIGHT_ARROW","DOWN_ARROW","LEFT_ARROW","UP_ARROW"] or

["UP_ARROW","RIGHT_ARROW","DOWN_ARROW","LEFT_ARROW"]

or ["LEFT_ARROW","UP_ARROW","RIGHT_ARROW","DOWN_ARROW"] or ["DOWN_ARROW","LEFT_ARROW","UP_ARROW","RIGHT_ARROW"]

...etc

It's possible to generate all combinations to the new list?

I tested by itertools.permumations or combinations but this result isn't what i want.

Any ideas?




Aucun commentaire:

Enregistrer un commentaire