python calculate computation time

Solutions on MaxInterview for python calculate computation time by the best coders in the world

showing results for - "python calculate computation time"
Charlie
28 Aug 2020
1import time 
2begin = time.time()
3''' your script here '''
4time.sleep(1)  # store end time 
5end = time.time()  # total time taken 
6print(f"Total runtime of the program is {end - begin}") 
7# https://www.geeksforgeeks.org/python-measure-time-taken-by-program-to-execute/