We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2fa555b commit c25c1f0Copy full SHA for c25c1f0
maths/fibonacci.py
@@ -19,7 +19,7 @@
19
import functools
20
from math import sqrt
21
from time import time
22
-from collections.abc import Generator
+from collections.abc import Iterator
23
24
25
def time_func(func, *args, **kwargs):
@@ -61,10 +61,9 @@ def fib_iterative(n: int) -> list[int]:
61
fib.append(fib[-1] + fib[-2])
62
return fib
63
64
-def fib_iterative_yield(n: int) -> Generator[int]:
+def fib_iterative_yield(n: int) -> Iterator[int]:
65
"""
66
- Calculates the first n (1-indexed) Fibonacci numbers using iteration with yield method to save memory
67
- >>> f = fib_iterative_yield(3)
+ Calculates the first n (1-indexed) Fibonacci numbers using iteration with yield
68
>>> next(f)
69
1
70
0 commit comments