-
-
Notifications
You must be signed in to change notification settings - Fork 47k
Update fibonacci_sequence_recursion.py #1268
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
Conversation
Fixed Missing return statement.
@@ -4,7 +4,7 @@ def recur_fibo(n): | |||
if n <= 1: | |||
return n | |||
else: | |||
(recur_fibo(n-1) + recur_fibo(n-2)) | |||
return recur_fibo(n-1) + recur_fibo(n-2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return n if n <= 1 else recur_fibo(n-1) + recur_fibo(n-2)
@@ -1,10 +1,7 @@ | |||
# Fibonacci Sequence Using Recursion | |||
|
|||
def recur_fibo(n): | |||
if n <= 1: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add this doctest:
def recur_fibo(n):
"""
>>> [recur_fibo(i) for i in range(12)]
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
"""
return n if n <= 1 else recur_fibo(n-1) + recur_fibo(n-2)
return n | ||
else: | ||
(recur_fibo(n-1) + recur_fibo(n-2)) | ||
return n if n <= 1 else recur_fibo(n-1) + recur_fibo(n-2) | ||
|
||
def isPositiveInteger(limit): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isPositiveInteger() function is too simple to be useful. Please removed it and do the test inline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
print("The first {limit} terms of the fibonacci series are as follows:") needs to be changed to be an f-string print(f"The ...
I just lost the forked-version hence cannot change (New GitHub user mistakes) |
Fixed Missing
return
statement.