~/ 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/42db915c-0b37-4776-ad71-a53f4b29cdfe/flashcard utf-8 LF