Skip to content
Merged
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
Added type hints for maths/fibonacci_sequence_recursion.
  • Loading branch information
frangiz committed Aug 30, 2020
commit 7db735d07592bfad91b021a8724f458340b7c76a
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