Added type hints for maths/fibonacci_sequence_recursion. (#2372)

This commit is contained in:
Björn Olsson Jarl 2020-08-30 10:51:45 +02:00 committed by GitHub
parent ab5a046581
commit 8c191f1fc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,7 @@
# 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]
@ -9,7 +9,7 @@ def recur_fibo(n):
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:")