mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-01-31 06:33:44 +00:00
Added type hints for maths/fibonacci_sequence_recursion. (#2372)
This commit is contained in:
parent
ab5a046581
commit
8c191f1fc9
|
@ -1,7 +1,7 @@
|
||||||
# Fibonacci Sequence Using Recursion
|
# Fibonacci Sequence Using Recursion
|
||||||
|
|
||||||
|
|
||||||
def recur_fibo(n):
|
def recur_fibo(n: int) -> int:
|
||||||
"""
|
"""
|
||||||
>>> [recur_fibo(i) for i in range(12)]
|
>>> [recur_fibo(i) for i in range(12)]
|
||||||
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
|
[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)
|
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: "))
|
limit = int(input("How many terms to include in fibonacci series: "))
|
||||||
if limit > 0:
|
if limit > 0:
|
||||||
print(f"The first {limit} terms of the fibonacci series are as follows:")
|
print(f"The first {limit} terms of the fibonacci series are as follows:")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user