Skip to content

Commit

Permalink
Added type hints for maths/fibonacci_sequence_recursion. (#2372)
Browse files Browse the repository at this point in the history
  • Loading branch information
frangiz authored Aug 30, 2020
1 parent ab5a046 commit 8c191f1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions maths/fibonacci_sequence_recursion.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Fibonacci Sequence Using Recursion


def recur_fibo(n):
def recur_fibo(n: int) -> int:
"""
>>> [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)


def main():
def main() -> None:
limit = int(input("How many terms to include in fibonacci series: "))
if limit > 0:
print(f"The first {limit} terms of the fibonacci series are as follows:")
Expand Down

0 comments on commit 8c191f1

Please sign in to comment.