Make sure that there would be no initial white space in the sentence means there should be no spaces in the string where the sentence start, otherwise it will assume a space as a word so the whole flow of sentence missmatch to the what you are typing
@@harshbhatt7585 yeah...no space is there..still the result is same, sentences are in the following form: There is no doubt that there can be no gain without pain. The white color has an Ashoka Chakra of blue color on it. Alexander the Great was a successful ruler.
i'm getting error in this code 1st- 'tester' object has no attribute 'clock' 2nd- in run threading.Thread(target=self.clock).start() 3rd - in __init__ self.run() and i don't know what to do ...can you help
sorry for late reply, basically these are same error which is pointing twowards testor has no arrtibute 'clock' make sure you have defined clock function inside the tester class and make sure you have passed self as parameter in the clock method(function), if you still getting error plzz reply me I would like to help you out through this.
Awesome Bro❤❤❤❤❤❤❤❤
Very nice 😁😁😁😁😁😀😀😀
Again i have a error in accuracy can u help me with that???
Okay! What's the error
@@harshbhatt7585 i took a file having 5 to10 sentences...
print ("\t\t\t\t\t\tSPEED TYPING TEST") #printing heading
#importing libraries
import time
import datetime
import threading
import random
import winsound #for beep
dur=500
freq=500
#creating class
class tester:
def __init__( self):
self.incorrectWords = {}
self.correctWords = [ ]
self.typedWords = [ ]
self.totalWords=[ ]
self.time =0
self.input = None
self.wordsPerMin = 0
self.run()
self.accuracy=0
self.getChallenge()
#function for time
def clock(self):
while len(self.typedWords)==0:
self.time += 1
time.sleep(1)
#function for running program in parallel
def run(self):
threading.Thread(target=self.clock).start()
threading.Thread(target=self.testSpeed).start()
def getChallenge(self):
return random.choice(open('sentences.txt').read().split('
'))
#function for spliting in sentence in words
def testSpeed (self):
print('
'+self.getChallenge()+'
')
self.input=str(input('\t
'+'Start Typing
'))
self.totalWords = self.getChallenge().split(" ")
self.typedWords = self.input.split(" ")
#function for saving one variable in another
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)
#check accuracy
self.accuracy=(len(self.correctWords)/ len(self.typedWords))*100
#calculate words epr minute
self.wordsPerMin=int(len(self.typedWords)/(self.time/60))
winsound.Beep(dur,freq) #beep is produced
#printing resuts
print(("\t\t\t\t\t\t RESULT---"))
print( f'
\t\tWPM--- {self.wordsPerMin}' , f'\t\t\t time--- {self.time} sec' ,f'\t\t\t accuracy-- {self.accuracy}' )
print(f'incorrectWords--- {self.incorrectWords}')
# print(f'correctWords--- {self.correctWords}')
#calling function
Mytester = tester ()
Mytester.getChallenge()
but again accuracy is not coming properly..
Make sure that there would be no initial white space in the sentence means there should be no spaces in the string where the sentence start, otherwise it will assume a space as a word so the whole flow of sentence missmatch to the what you are typing
@@harshbhatt7585 yeah...no space is there..still the result is same, sentences are in the following form:
There is no doubt that there can be no gain without pain.
The white color has an Ashoka Chakra of blue color on it.
Alexander the Great was a successful ruler.
Send me the whole code in my email, harshbhatt7585@gmail.com,
How to run a python game in mobile
yes, you can make apps and games for mobile with kivy, it is a python framework for the development of mobile application
i'm getting error in this code
1st- 'tester' object has no attribute 'clock'
2nd- in run
threading.Thread(target=self.clock).start()
3rd - in __init__
self.run()
and i don't know what to do ...can you help
sorry for late reply,
basically these are same error which is pointing twowards testor has no arrtibute 'clock'
make sure you have defined clock function inside the tester class and make sure you have passed self as parameter in the clock method(function), if you still getting error plzz reply me I would like to help you out through this.