import sys import time t1=time.clock() count_mul=0 count_add=0 def fibonnaci(n): a, b = 0, 1 for i in range(n): a, b = b, a + b return a product=1 fibr = open("in2_10.txt") buff=fibr.read() x=int(buff) for i in range(1, x+1): product*= fibonnaci(i) count_add+= fibonnaci(i)-1 count_mul=count_mul+1 fibw = file("out_20_2_10.txt",'w') print >>fibw, product fibw.write('\n total no of additions is'+" "+ str(count_add)+ '\n') fibw.write('\n total no of miutiplications is'+" "+ str(count_mul)+ '\n') t2=time.clock() fibw.write('time taken is'+" "+ str(t2-t1)+ '\n') fibw.write('memory taken'+" "+ str(sys.getsizeof(fibonnaci)+sys.getsizeof(product))+'\n') fibw.close()