Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions maths/fibonacci_sequence_recursion.py
Original file line number Diff line number Diff line change
@@ -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.

return limit >= 0
Expand Down