We can make use of the %time magic command in a Cell of a Jupyter Notebook to measure the execution time of a Python program.
Let us take a look at a few examples.
Example 1: A single Statement in a Cell
%time print(30*4039*3929)
476076930
CPU times: user 199 µs, sys: 189 µs, total: 388 µs
Wall time: 368 µs

Example 2: Execution Time of a Function Call
def func():
sum = 293*19839*29
print(sum)
We have the function in one cell and we call it from another.
%time func()
168571983
CPU times: user 36 µs, sys: 4 µs, total: 40 µs
Wall time: 42.9 µs

This works on Google Colab Notebooks as well.

Documentation:
https://ipython.org/ipython-doc/3/interactive/magics.html#magic-time
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!