I want to create a dictionary in python with 40 key/value pairs. They keys should be a1, a2 ... a10, b1, b2 ... b10, c1, c2 ... c10, d1, d2 ... d10. I have a for loop that takes two variables and modifies them so they change after each loop. It loops 40 times to create 40 different values for each of the two variables.
In the dictionary, the value for the key a1, should be the value of x and y in the first loop. The value for the key a2 should be the value of x and y in the second loop. This continues to the key d10 which should have the value of x and y in the 40th loop.
How can I do this? I think I can use a for loop, but since I struggle with understanding for loops, I don't know what I should do.
Here is my code:
x = 200
y = 202
for i in range(40):
if y != 202 + 9 * 84:
y += 84
else:
x += 100
y = y - 9 * 84
I want a dictionary that looks like this:
dictionary = {'a1':(200, 202), 'a2':(# the value of x and y after looping a second time, here it will be 200, 286)}