I have two lists and I want to place the two lists in a dictionary. I shuffled the second list. Now when I print the both list in dictionary then it works perfectly but the positions in dictionary changes when I try more than once.
import random
from random import shuffle
s = ['a','b','c','d']
l=[1,2,3,4]
shuffle(l)
b=dict(zip(s,l))
print(b)
Now the output for the first time is
{'a': 1, 'c': 3, 'b': 4, 'd': 2}
When I try second time I got
{'d': 1, 'c': 3, 'b': 2, 'a': 4}
Shuffling works fine but my problem is : I want to fix the key values positions a,b,c,d in dictionary and the only 1,2,3,4 should be shuffled. Is this possible using dictionaries..? What should I use to fix the keys and shuffle the values..