1import time
2start_time = time.time()
3main()
4print("--- %s seconds ---" % (time.time() - start_time))
5
1import time
2
3# starting time
4start = time.time()
5
6# program body starts
7for i in range(10):
8 print(i)
9
10# sleeping for 1 sec to get 10 sec runtime
11time.sleep(1)
12
13# program body ends
14
15# end time
16end = time.time()
17
18# total time taken
19print(f"Runtime of the program is {end - start}")