I need to use a variable that I created inside a function outside the function
ls1 = []
ls2 = []
def process_line(filename):
i = 0
global ls 1
global ls2
tup = ()
while i<len(filename):
if i%2==0:
ls1.append(float(filename[i]))
else:
ls2.append(float(filename[i]))
i += 1
tup = tup + (ls1, )
tup = tup + (ls2, )
return tup
process_line(filename)
if command == 'regular':
k = 0
print('Regular Transactions:')
while k<7:
print('{}: +{:.2f} -{:.2f}'.format(weekdays[k], ls1[k], ls2[k]))
however, it is written that ls1 and ls2 are not defined. how to call the variable?