python calculate time taken

import time
start = time.process_time()
# your code here    
print(time.process_time() - start)

Here is what the above code is Doing:
1. It’s creating a variable called start and setting it equal to the current time.
2. It’s running the code you want to time.
3. It’s printing the difference between the current time and the start time.

This is a very simple way to time your code, but it’s not very accurate.

A more accurate way to time your code is to use the timeit module.

The timeit module is a built-in module that allows you to time your code.

Here’s how to use it: