To choose which program is the best when several offer the same functionality. Their execution time is calculated. I’m trying to gauge how quickly my Python programs run. I’ve discovered that Python provides packages that help us determine how long any program will take to execute. I got an error from the code I wrote to calculate the execution time of the Python program. The code and error are shown below:
import time start_time = time.time() name=input('Enter your name:') age=input('Enter your age:') print('Your name is:',name) print('Your age is:',age) end_time = time() execution_time = end_time - start_time print("Execution time:", execution_time, "seconds")
TypeError: 'module' object is not callable
I don’t understand what the mistake is attempting to say. Please explain the error to me if you can. I would appreciate it if you could fix my code and offer me some different approaches to help me determine how long the program took to execute.