Answers for "python jointly shuffle list"

0

python jointly shuffle list

import random

a = ['a', 'b', 'c']
b = [1, 2, 3]

c = list(zip(a, b))

random.shuffle(c)

a, b = zip(*c)

print a
print b

[OUTPUT]
['a', 'c', 'b']
[1, 3, 2]
Posted by: Guest on September-08-2021

Python Answers by Framework

Browse Popular Code Answers by Language