I'm trying to access the counter variable in my function, why doesn't it work and how do I resolve it?
Relevant code:
sum = 0
counter = 0
def newFibo(a, b) :
if(counter > 4000000) :
return
c = a + b
sum += c
counter +=1
newFibo(b,c)
newFibo(1,2)
print(sum)
error: "local variable 'counter' referenced before assignment"