jeudi 25 mars 2021

Shuffle two arrays the same way in python [duplicate]

I know that I can do the following

import random
random.shuffle(array)

but I need to shuffle to arrays the same way. something like this:

array1 = [1, 2, 3, 4, 5]
array2 = ["one", "two", "three", "four", "five"]
ramdom.shuffle(array1, array2)
print(array1, array2)
>>>>
[2, 3, 1, 5, 4]
["two", "three", "one", "five", "four"]



Aucun commentaire:

Enregistrer un commentaire