import sys from time import clock def main(): start=clock() f=open("in3_1.txt","r") n=int(f.read())-1 f.close() pim(n) end=clock() f2=open("out_31_3_1.txt","a") f2.write("\nTime taken by the program is : %f seconds" %(end-start)) mem=sys.getsizeof(f)+sys.getsizeof(f2)+sys.getsizeof(n)+1092 f2.write("\nMemory used by the program is : %d bytes." %mem) f2.close() def pim(n): counta=0 #to count the no. of additions. f1=open("out_31_sec3_1.txt","w") write=f1.write if n<2: return if n<3: write('2') return x=5 temp=[2,3] append=temp.append #In python, local variables are easier to access than global ones. l=len write('2,3') n=n+1 counta+=1 while l(temp)