forked from NitulKalita/Python-CLI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypingspeed.py
More file actions
32 lines (26 loc) · 871 Bytes
/
typingspeed.py
File metadata and controls
32 lines (26 loc) · 871 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
30
31
32
from time import time
print("\nType the sentence given below")
s = "The Quick Brown Fox Jumps over the lazy dog."
words = (len(s.split()))
print()
print(s)
print("\nAfter you are done press enter to know your time and speed")
input("Press any key to Start:")
while True:
print("\nTimer Started\n")
start = time()
t = input()
end = time()
if t == s:
total = round(end - start, 2)
print("\nHurray you typed that correctly")
print("Your time was %s seconds" % total)
total = int(total) / 60
print("Speed was %s WPM" % (str(words // total)))
break
else:
print("\nWrongly entered - Enter the sentence as it is shown\n")
user_input = input("Press Enter to Play Again\n")
print("\nType the sentence given below")
print(s,"\n")
input("Press any key to Start:")