how to count how long a program takes to complete in 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: python how to measure code run in time

import time
start_time = time.time()
main()
print("--- %s seconds ---" % (time.time() - start_time))

Example 3: how to count how long a program takes to complete in python

#ok for whom looking for answer this one only work on linux 
#u can use this command in terminal to check script run time
time python3 <script-name>