It is quite often, that we need to measure the execution time of a piece of code in Python. When we want to do that, it is very easy to fall into the trap of time module.

For example, assume we have a while loop:

i = 0
while i < 10000:
i += 1

If we want to measure that piece of code, then we can use time module. A lot of you know about it. It helps you to work with time in Python and has a built-in function time(), that returns you the time since the Epoch

Andrey Ivanov

Hello! I'm just a python programmer :)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store