Homework
1 Programming concepts
1. The following pseudocode tests how quickly a user can type a given sentence without
making any mistakes.
The statement finishTime = time.clock() returns wall-clock seconds elapsed since the first call
to this function and places the answer in finishTime.
1. import time
2. sentence = "The quick brown fox jumped over the lazy dog"
3. n = len(sentence
4. print ("Sentence to type: ", sentence)
5. errorElag = False
6. print ("Press Enter when you're ready to start typing! Press Enter when finished")
7. ready=input()
8. print("Go")
9. time.clock()
10. mySentence=input()
11. finishTime=time.clock()
12. if mySentence <> sentence then
13. errorElag True
# you can call the function without returning a value
14. endif
15. finishTime round(finishTime, 1)
16. if errorElag== True then
17. print ("You made one or more errors")
18. else
19. print ("Total time taken ".totalTime. "seconds")
20. endif