The condition mentioned in the explanation is: If n
is negative or zero, return -1
.
But the solution ignores this condition by assigning 0 to n=1
first = 0
second = 1
if n < 1:
return -1
if n == 1:
return first
This causes the Fib(7) to be calculated as 8 instead of 13