Answers for "how to shuffle dictionary python"

1

how to shuffle dictionary python

import random

d = {'a':1, 'b':2, 'c':3, 'd':4}
l = list(d.items())
random.shuffle(l)
d = dict(l)
Posted by: Guest on March-08-2022

Python Answers by Framework

Browse Popular Code Answers by Language