Hello,
Pls can somebody help me with time comparison between 2 scripts. I have already looked the documentation but I haven't found anything.
I deal with following exercise:
"Run this version of fibonacci and the original with a range of parameters and
compare their run times."
I intend to measure the time for this script.
import time
known = {0:0, 1:1}
def fibonacci(n):
t0=time.time()
if n in known:
return known[n]
res = fibonacci(n-1) + fibonacci(n-2)
known[n] = res
print t0
return res
print fibonacci(3)
Thank you for help