You can use the time
module to time input in python. The basic idea is to record the start time before input is entered, record the end time after the input is entered, and calculate the difference between these two times, which gives you the time taken to enter the input. Here's an example:
main.py189 chars8 lines
In this example, the time()
function is used to record the start time and end time, and the input()
function is used to take in the user input. Finally, the difference between the end time and start time is printed, along with the input entered by the user.
Note that this timing method is not precise, and may vary depending on system load and other factors. But it should give you a rough estimate of the time taken to perform an input operation.
gistlibby LogSnag