Dynamic = [1L,1L] def fib(n): if Dynamic[n:n+1] : return Dynamic[n] else: x = fib(n-1) + fib(n-2) Dynamic[n:n+1] = [x] return x