calculate time of code python code example
Example 1: python calculate time taken
import time
start = time.process_time()
# your code here
print(time.process_time() - start)
Example 2: find time of run for python code
import time
start_time = time.time()
main()
print("--- %s seconds ---" % (time.time() - start_time))