Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return should be 1 when n <= 2 #11

Closed
aramay opened this issue Nov 18, 2019 · 1 comment
Closed

return should be 1 when n <= 2 #11

aramay opened this issue Nov 18, 2019 · 1 comment

Comments

@aramay
Copy link

aramay commented Nov 18, 2019

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

ATM it returns n

@davecom
Copy link
Owner

davecom commented Nov 18, 2019

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.

@davecom davecom closed this as completed Nov 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants