a1 = 2
a2 = 4
a3 = 5
xa1 = 0
xa2 = 0
xa3 = 0
d = {a1 : xa1, a2 : xa2}
l1 = [a1, a2]
for item in l1:
d[item] += item
In this code, I want the value of a1
to be in xa1
, and a2
to be in xa2
, but not for xa3
.
I tried to do it this way but this might not be a right way to do it. My way of doing this is not correct, so if there is another way, please help me out.
(Note that there are 81 variable like a1, a2 and so on, and 81 like xa1, xa2 and so on and they are selected randomly to have the value copied from 'a' variables)
I hope I didn't make a mess and people can understand what I'm trying to say.