-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproject(speed).py
More file actions
35 lines (28 loc) · 854 Bytes
/
project(speed).py
File metadata and controls
35 lines (28 loc) · 854 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
33
34
35
from time import *
import random as r
def mistake(partest, usertest):
error = 0
for i in range(len(partest)):
try:
if partest[i] == usertest[i]:
error += 1
except :
error += 1
return error
def speed_time(time_s, time_e, userinput):
time_delay = time_e - time_s
time_R = round(time_delay,2)
speed = len(userinput)/ time_R
return round(speed)
test =["Python is a high level language which can be used to generate different programs.",
"My name is Nushant Ghimire","this is my python project."]
test1 = r.choice(test)
print(" *****Typing speed calculator*****")
print(test1)
print()
print()
time_1 = time()
testinput = input(" Enter : ")
time_2 = time()
print("Speed : ",speed_time(time_1, time_2, testinput)," w/sec")
print("Error : ",mistake(test1, testinput))