~/ learn/ python-from-zero/ cards/ The nth Fibonacci number
1 of 1

Write a function that returns the nth Fibonacci number.

Write a function that returns the nth Fibonacci number.

Answer

def fib(n): a, b = 0, 1 for _ in range(n): a, b = b, a + b return a print(fib(10))

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/f6215783-f812-4137-87a1-ab1573e6554a/flashcard utf-8 LF