How do you calculate program run time in python?

feisky picture feisky · Apr 11, 2011 · Viewed 290k times · Source

How do you calculate program run time in python?

Answer

H.Rabiee picture H.Rabiee · May 7, 2013

Quick alternative

import timeit

start = timeit.default_timer()

#Your statements here

stop = timeit.default_timer()

print('Time: ', stop - start)