The time module
The time module allows the user to directly get the time, in seconds, since 1970 (See: https://docs.python.org/3/library/time.html). This means that we can subtract the time before from time after to see how long it has been, namely how long it took the user to finish the typing test. From there, it is as easy as printing the result. You can round the time using int to get a purely seconds result without milliseconds.
The code
# Import the time library
import time
# Calculate the start time
start = time.time()
# Code here
# Calculate the end time and time taken
end = time.time()
length = end - start
# Show the results : this can be altered however you like
print("It took", length, "seconds!")
Answer from Larry the Llama on Stack OverflowPython Timer module - Stack Overflow
How to make a timer without importing?
How to make a timer ?
Python timer
Videos
The time module
The time module allows the user to directly get the time, in seconds, since 1970 (See: https://docs.python.org/3/library/time.html). This means that we can subtract the time before from time after to see how long it has been, namely how long it took the user to finish the typing test. From there, it is as easy as printing the result. You can round the time using int to get a purely seconds result without milliseconds.
The code
# Import the time library
import time
# Calculate the start time
start = time.time()
# Code here
# Calculate the end time and time taken
end = time.time()
length = end - start
# Show the results : this can be altered however you like
print("It took", length, "seconds!")
You can use the built-in time library:
import time
str_to_type = "The cat is catching a mouse."
start_time = time.perf_counter()
print("Type: '" + str_to_type + "'.")
typedstring = input()
if typedstring == str_to_type:
end_time = time.perf_counter()
run_time = end_time - start_time
print("You typed '" + str_to_type + "' in", str(run_time), "seconds.")
This depends on your code logic. But from the code supplied, most probably it is Timer from threading module, so you just have to add this at the top of your code
from threading import Timer
Documentation is here: threading.Timer
Even though this is probably not the case here given the context, it is also possible that the Timer is from the timeit module which allows to run tests on the quickness of execution.
That is, from timeit import Timer
https://docs.python.org/3/library/timeit.html