Skip to content

Update fibonacci_sequence_recursion.py#1268

Closed
NikhilCodes wants to merge 2 commits into
TheAlgorithms:masterfrom
NikhilCodes:patch-1
Closed

Update fibonacci_sequence_recursion.py#1268
NikhilCodes wants to merge 2 commits into
TheAlgorithms:masterfrom
NikhilCodes:patch-1

Conversation

@NikhilCodes

Copy link
Copy Markdown
Contributor

Fixed Missing return statement.

Fixed Missing return statement.
Comment thread maths/fibonacci_sequence_recursion.py Outdated
return n
else:
(recur_fibo(n-1) + recur_fibo(n-2))
return recur_fibo(n-1) + recur_fibo(n-2)

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

# Fibonacci Sequence Using Recursion

def recur_fibo(n):
if n <= 1:

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

(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):

@cclauss cclauss Oct 3, 2019

Copy link
Copy Markdown
Member

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.

@cclauss cclauss left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
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