Advertisement
kevinbocky

input_game2.py

Dec 30th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. from time import sleep, time
  2.  
  3. loop = input("How many times do you want to try your reaction skills? ")
  4. count = 0
  5. total = 0
  6.  
  7. for i in range(int(loop)):
  8. print("Attempt number " + str(count + 1))
  9. sleep(5)
  10.  
  11. start = time()
  12. print("Quick, press enter")
  13. input()
  14. print("That was fast")
  15. stop = time()
  16.  
  17. reaction_time = (stop - start)
  18. print("You took "+ str(reaction_time) + " seconds")
  19. count = count + 1
  20. total = float(total) + float(reaction_time)
  21.  
  22. print("")
  23. print(str(total) + " seconds combined time")
  24. average = float(total) / int(loop)
  25. print("")
  26. print(str(average) + " seconds average time")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement