In order to get the execution time of a Python program, you can make use of the time() function from the time module.
Example:
import time
program_start_time = time.time()
def func1():
print("func 1 called!")
def func2():
print("func 2 called!")
def func3():
print("func 3 called!")
func1()
func2()
func3()
program_end_time = time.time()
print("The Program took ", program_end_time - program_start_time," seconds to run!")
Result:
func 1 called!
func 2 called!
func 3 called!
The program took 0.0028166770935058594 seconds to run!

Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!