I have this program
dict1={
'x':1,
'y':[10,20]
}
for each in list(dict1.keys()):
exec(each=dict1["each"])
#exec('x=dict["x"]')
#exec('y=dict["y"]')
print(x)
print(y)
what i really want is this
exec('x=dict1["x"]') ##commented part
exec('y=dict1["y"]') ##commented part
whatever i am doing in commented part that i want to do in for loop.so, that expected output should be
1
[10,20]
but it is giving error. wanted to create dictionay keys as a variables and values as a varialbe values. but no lock. can anyone please suggest me how to achieve that or it is not possible?