FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Basic-Python-Programs/SpeedTypingTestInPython.py at main · gitishman/Basic-Python-Programs · GitHub
gitishman
/
Basic-Python-Programs
Public
forked from
souravjain540/Basic-Python-Programs
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Basic-Python-Programs
/
SpeedTypingTestInPython.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
61 lines (46 loc) · 1.81 KB
Breadcrumbs
Basic-Python-Programs
/
SpeedTypingTestInPython.py
Copy path
File metadata and controls
61 lines (46 loc) · 1.81 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
### Speed Typing Test in python ###
# Imported Library
import
time
import
threading
# Created Class
class
tester
:
def
__init__
(
self
,
paragraph
):
self
.
correctWords
=
[]
self
.
incorrectWords
=
{}
self
.
typedWords
=
[]
self
.
totalWords
=
[]
self
.
input
=
None
self
.
paragraph
=
paragraph
self
.
accuracy
=
0
self
.
time
=
0
self
.
wordPermin
=
0
self
.
run
()
#### Defined the Variable ###
def
clock
(
self
):
while
len
(
self
.
typedWords
)
==
0
:
self
.
time
+=
1
time
.
sleep
(
1
)
def
run
(
self
):
threading
.
Thread
(
target
=
self
.
clock
).
start
()
threading
.
Thread
(
target
=
self
.
testSpeed
).
start
()
def
testSpeed
(
self
):
print
(
'
\n
\n
'
+
self
.
paragraph
+
'
\n
\n
'
)
self
.
input
=
str
(
input
(
'
\t
\n
'
+
'Type The Word Which You Want To Know the Speed As well as Incorrect
\n
\n
'
))
self
.
totalWords
=
self
.
paragraph
.
split
(
' '
)
self
.
typedWords
=
self
.
input
.
split
(
' '
)
try
:
for
i
in
range
(
len
(
self
.
typedWords
)):
if
(
self
.
typedWords
[
i
]
==
self
.
totalWords
[
i
]):
self
.
correctWords
.
append
(
self
.
typedWords
[
i
])
else
:
self
.
incorrectWords
.
update
({
self
.
totalWords
[
i
] :
self
.
typedWords
[
i
]})
except
Exception
as
e
:
print
(
e
)
self
.
accuracy
=
len
(
self
.
correctWords
)
/
len
(
self
.
typedWords
)
*
100
self
.
wordPerMin
=
len
(
self
.
typedWords
)
/
(
self
.
time
/
60
)
print
(
'
\n
\n
Result :--'
)
print
(
f'Accuracy: --
{
self
.
accuracy
}
'
)
print
(
f'Word Per Minute :--
{
self
.
wordPerMin
}
'
)
print
(
f'Incorrect Words :--
{
self
.
incorrectWords
}
'
)
Mytester
=
tester
(
"You know you're a programmer when you spend a day to find the problem, and then fix it with one line of code."
)
### The Code is ended, Thank You ####
Back
|
FazBrowse Home
|
New Git URL