Pytest a nice Fibonacci example
This is an implementation of the Fibonacci function.
def fib(n):
a, b = 1, 1
for _ in range(1, n):
a, b = b, a+b
return a
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
This is an implementation of the Fibonacci function.
def fib(n):
a, b = 1, 1
for _ in range(1, n):
a, b = b, a+b
return a