I am trying to make a typing speed tester. The program takes a line from a file that contains words and prints it in the console then it asks the user to type in the printed line to check how fast the user types. But I want to start the timer function only when the user hits the first key and then end it when he presses enter key after typing the whole line.
print(line)
start = time()
entered_line = input()
end = time()
total_time += end - start
The above piece of code is enclosed in a for loop above it. What I have been able to do as I am a beginner is that I start the time immediately after the line from the file is printed on the screen that results in error if the user doesn't start typing immediately. So an easy and simple solution will be appreciated. Thanks!