1# Dynamic approach to get nth fibonacci number
2arr = [0,1]
3
4def fibonacci(n):
5 if n<0:
6 print("Fibbonacci can't be computed")
7 elif n<=len(arr):
8 return arr[n-1]
9 else:
10 temp = fibonacci(n-1)+fibonacci(n-2)
11 arr.append(temp)
12 return temp
13
14print(fibonacci(9))