Search This Blog

Saturday, 25 February 2017

Python program for measuring time complexity


import time
t1 = time .time()

for i in range(1,1000):
    if i%2==0:
        print(str(i)+"num is even")
    else :
        print(str(i)+"num is odd")
       
t2 = time.time()
t3 = t2 - t1
print(t2,t1)
print(t3)

No comments:

Post a Comment