I have a function that makes a dictionary based on file input. Then another function that makes a calculation based on the dictionary. These 2 functions are nested in a main function. I.e:
def make_dic():
data=dict()
code...
return data
def make_calculation():
for x,y in data.items()
code....
def main():
data=make_dic()
make_calculation()
My problem is that I get an error: NameError: name 'data' is not defined
How can I get make_calculation() recognize the dictionary created in make_dic() when they are nested in main()?
Thanks.