I was playing with a sudoku solver, and came across this interesting behavior. When I enter a number (0,5) the function will keep going up to the upper limit (5). Once the limit is reached it still keeps printing my number (a), but decreasing the value? (Shown below).
Why is this?
def solver(a):
print("->",a)
if a == 0 or a == 5:
return
else:
a = a+1
print("-->",a)
solver(a)
print("---")
print(a)
gives
-> 2
--> 3
-> 3
--> 4
-> 4
--> 5
-> 5
---
5
---
4
---
3