python print how long it takes to run

import time
start_time = time.time()
 #your program
print ("My program took", time.time() - start_time, "to run")

Here is what the above code is Doing:
1. We import the time module.
2. We set a start_time variable to the current time.
3. We run our program.
4. We print out the time it took to run our program.