I want to save the incoming data into an array that remember its previous array position
test.py
global data, in_data
data_hold = {}
data = 0
def start_input(atm_data):
data_hold[data] = atm_data
When calling twice from other module:
test.start_input (5)
test.start_input (6)
The error output is:
UnboundLocalError: local variable 'data' referenced before assignment
I tried to put data = 0
inside the start_input(atm_data)
module, but the data is input into
data_hold[0] = 5
data_hold[0] = 6
I want the output to be:
data_hold[0] = 5
data_hold[1] = 6, and so on