Skip to content

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

Closed
wants to merge 2 commits into from
Closed

Update fibonacci_sequence_recursion.py #1268

wants to merge 2 commits into from

Conversation

NikhilCodes
Copy link
Contributor

Fixed Missing return statement.

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)
Copy link
Member

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:
Copy link
Member

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):
Copy link
Member

@cclauss cclauss Oct 3, 2019

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.

Copy link
Member

@cclauss cclauss left a 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 ...

@NikhilCodes
Copy link
Contributor Author

I just lost the forked-version hence cannot change (New GitHub user mistakes)
Hence I request reviewer to not mark it spam (Reason: Hacktober).
But I have created another branch to make changes intended to this branch.
New Branch: #1287

@cclauss cclauss closed this Oct 6, 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

Successfully merging this pull request may close these issues.

2 participants