Please take a look on the code. What I'm trying to achieve:
I will be glad if you teach me how to do it properly. I try to fix the problem for past 2 days with no success.
dict = {"v1": 0,"v2": 0}
list = ["a","b"]
def calc(n):
import time
i = 0
while True and i < len(list) and n <= len(dict):
while True:
dict["v" + str(n)] = list[i]
i = i + 1
time.sleep(1)
print(dict)
if i == len(list):
dict["v" + str(n)] = 0
calc(n+1)
Desired output would be:
{'v1': 'a', 'v2': 0}
{'v1': 'b', 'v2': 0}
{'v1': 0, 'v2': 'a'}
{'v1': 'a', 'v2': 'a'}
{'v1': 'b', 'v2': 'a'}
{'v1': 0, 'v2': 'b'}
{'v1': 'a', 'v2': 'b'}
{'v1': 'b', 'v2': 'b'}
What i get is:
{'v1': 'a', 'v2': 0}
{'v1': 'b', 'v2': 0}
{'v1': 0, 'v2': 'a'}
{'v1': 0, 'v2': 'b'}