-
Notifications
You must be signed in to change notification settings - Fork 110
Expand file tree
/
Copy pathaccuracy.py
More file actions
29 lines (21 loc) · 769 Bytes
/
accuracy.py
File metadata and controls
29 lines (21 loc) · 769 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import time
def speed():
name = input("Enter your name here: ")
print("You can type 'done' to end the test.")
print("All the best!\n")
sentence = "Hello I'm good"
print("Type the following sentence exactly as shown:\n➡️", sentence)
input("\nPress Enter to start...")
start = time.time()
while (sen := input("\nEnter the sentence here:\n")) != "done":
if sentence == sen:
print("✅ You got it right!")
break
else:
print("❌ Type again...")
end = time.time()
timetaken = end - start
speed_wpm = (len(sentence.split()) / timetaken) * 60
print(f"\n⌛ Time Taken: {timetaken:.2f} seconds")
print(f"⚡ Speed: {speed_wpm:.2f} words per minute")
speed()