code
import random
d = {'a':[1,2], 'b':[2,4], 'c':[3,5], 'd':[2,4]}
l = list(d.items())
random.shuffle(l)
d = dict(l)
print(d)
result
{'b': [2, 4], 'd': [2, 4], 'a': [1, 2], 'c': [3, 5]}
code
result
{'b': [2, 4], 'd': [2, 4], 'a': [1, 2], 'c': [3, 5]}
No comments:
Post a Comment