Jul-29-2017, 08:36 PM
You set start and end time then subtract.
This way only make sense for longer running loop.
timeit as mention which is made for measuring execution times.
This way only make sense for longer running loop.
timeit as mention which is made for measuring execution times.
import time start = time.clock() for i in range(5): time.sleep(i) end = time.clock() print(f'Code time {end - start:.2f} seconds')
Output:Code time 10.01 seconds