I have been writing a basic timekeeping code and for some reason it’s not returning anything.
Here is the dictionary and list I am using to store the values:
TimeVarList = ['millennium', 'centuries', 'decades', 'years', 'weeks', 'days', 'hours', 'minutes', 'seconds']
TimeList = {
'millennium': {'Txt': 'millennium', 'Var': millennium, 'Limit': 9999, 'Next_Val': seconds},
'centuries': {'Txt': 'centuries', 'Var': centuries, 'Limit': 10, 'Next_Val': millennium},
'decades': {'Txt': 'decades', 'Var': decades, 'Limit': 10, 'Next_Val': centuries},
'years': {'Txt': 'years', 'Var': years, 'Limit': 10, 'Next_Val': decades},
'weeks': {'Txt': 'weeks', 'Var': weeks, 'Limit': 52, 'Next_Val': years},
'days': {'Txt': 'days', 'Var': days, 'Limit': 7, 'Next_Val': weeks},
'hours': {'Txt': 'hours', 'Var': hours, 'Limit': 24, 'Next_Val': days},
'minutes': {'Txt': 'minutes', 'Var': minutes, 'Limit': 60, 'Next_Val': hours},
'seconds': {'Txt': 'minutes', 'Var': seconds, 'Limit': 60, 'Next_Val': minutes},
}
And here is the code:
while True:
for i in TimeVarList:
if TimeList[i]['Var'] <= TimeList[i]['Limit']:
TimeList[i]['Next_Val'] += 1
TimeList[i]['Var'] = 0
if TimeList[i]['Var'] != 0:
print(TimeList[i]['Var'], TimeList[i]['Txt'])
for j in TimeVarList[i : len(TimeVarList)+1]:
if j != 0:
Not_Zero = True
break
else:
Not_Zero = False
time.sleep(time_wait)
seconds += time_wait
TimeList['millennium']['Limit'] += 0.000000000000000000000000001
For whatever reason when I execute the code it won’t do anything and won’t allow other code to be typed. Why does this happen?