davecom/ClassicComputerScienceProblemsInPython

return should be 1 when n <= 2

Closed this issue · 1 comments

line 20 in file fib2.py should return 1 when n <=2

ATM it returns n

It depends on if you consider the first number in the sequence to be 0 or 1. As it stands right now, if n is 0 it will return 0 and if n is 1, it will return 1.

We consider the first numbers to be 0 and 1. So, our sequence is 0, 1, 1, 2, 3, 5, etc.

Therefore returning 0 when n is 0 and 1 when n is 1 is correct as it stands.