#Python Program
import time
print("Type the following text as fast as you can:")
print("The quick brown fox jumps over the lazy dog.")
print("Press enter to start the test.")
input("")
start = time.time()
userInput = input("The quick brown fox jumps over the lazy dog\n")
userInput = userInput.strip()
end = time.time()
timeTaken = end - start
numWordsTyped = len(userInput.split())
typingSpeed = (numWordsTyped/timeTaken)*60
#Calculating accuracy
correctText = "The quick brown fox jumps over the lazy dog"
if correctText == userInput:
accuracy = 100
else:
accuracy = 0
print("Time taken: {:.2f} seconds".format(timeTaken))
print("Number of words typed: {}".format(numWordsTyped))
print("Typing speed: {:.1f} wpm".format(typingSpeed))
if accuracy == 100:
print("Good job! You typed the text accurately.")
else:
print("Sorry, you made a mistake while typing. Accuracy: {:.1f}%".format(accuracy))