Skip to content

Commit 1b3124e

Browse files
author
studentpiyush
committed
Add edge-case doctests to fibonacci.py (#9943)
1 parent a71618f commit 1b3124e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

maths/fibonacci.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,13 @@ def time_func(func, *args, **kwargs):
4040
def fib_iterative_yield(n: int) -> Iterator[int]:
4141
"""
4242
Calculates the first n (1-indexed) Fibonacci numbers using iteration with yield
43+
4344
>>> list(fib_iterative_yield(0))
4445
[0]
4546
>>> tuple(fib_iterative_yield(1))
4647
(0, 1)
48+
>>> tuple(fib_iterative_yield(2))
49+
(0, 1, 1)
4750
>>> tuple(fib_iterative_yield(5))
4851
(0, 1, 1, 2, 3, 5)
4952
>>> tuple(fib_iterative_yield(10))

0 commit comments

Comments
 (0)