Fibonacci numbers

Report a typo

The Fibonacci numbers (denoted FnF_{n}) form a sequence where each number is the sum of the two preceding ones: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ...

Fn=Fn1+Fn2F_{n} = F_{n-1} + F_{n-2} , and F0=0,F1=1F_0 = 0, F_1 = 1

Finish the template of a recursive function that finds the nth Fibonacci number. Here, you'll need to make multiple recursive calls inside the function!

You do NOT need to take input or call this function!

Write a program in Python 3
def fib(n):

# base case n = 0
if ...:
return
# base case n = 1
elif ...:
return
# case n > 1
else:
return
___

Create a free account to access the full topic