I am trying to write a program that takes reports and adds them to a list of tuples. The program should also make a dictionary with the value as a list of two integers. But when I try to change the global values of the two counter I get the error: "UnboundLocalError: local variable 'False_count' referenced before assignment".
report_list = []
success = True
report1 = ('nano1', 'Frida', False)
report2 = ('bio_x', 'Arnar', True)
report3 = ('nano1', 'Frida', True)
True_count = 0
False_count = 0
status_dict = {'nano1': [0,0], 'bio_x': [0,0]}
def report_list_maker(report_tuple):
report_list.append(report_tuple)
if report_tuple[2] == True:
True_count += 1
elif report_tuple[2] == False:
False_count += 1
print("False")
temp_dict = {report_tuple[0]:[False_count, True_count]}
status_dict.update(temp_dict)
report_list_maker(report1)
report_list_maker(report2)
report_list_maker(report3)
print(report_list)
print(status_dict)