I have dictionary which I'm looping through. I want to say that if a value == a certain number (0 in this case) then the value of the next iteration of the for loop will be 2x that value.
I have a dictionary like the following:
d = {'a' : 1, 'b' : 0, 'c' : 4}
When I loop through the dictionaries with a for loop I'd like to multiply the next iteration by 2 if the current iteration = 0.
for k, v in d.items():
if k == 0:
[next iteration v = v * 2]
else:
v = v + 1
So I would expect to end up with a dictionary like this:
d = {'a' : 2, 'b' : 0, 'c' : 9}
This is just a simple example but hopefully illustrates what I'm trying to achieve.
Thanks