| 1 |
from collections.abc import Iterator |
| 2 |
|
| 3 |
|
| 4 |
# This is an example |
| 5 |
class Math: |
| 6 |
@staticmethod |
| 7 |
def fib(n: int) -> Iterator[int]: |
| 8 |
"""Fibonacci series up to n.""" |
| 9 |
a, b = 0, 1 |
| 10 |
while a < n: |
| 11 |
yield a |
| 12 |
a, b = b, a + b |
| 13 |
|
| 14 |
|
| 15 |
result = sum(Math.fib(42)) |
| 16 |
print(f"The answer is {result}") |