timber101

20SecondsPython

Jun 9th, 2021
861
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # 20 second guessing game
  2.  
  3. # game starts here
  4.  
  5. import time as t
  6. target_time = 3 # change this to 20 when finished
  7.  
  8. print("Colin guess the time")
  9. print("====================")
  10.  
  11. input("When ready press ENTER to start >> ")
  12. start = int(t.time())
  13.  
  14. print("programme running...")
  15.  
  16. input("Press ENTER again when you think the time is up >> ")
  17. end = int(t.time())
  18.  
  19. guessed_time = end - start
  20.  
  21. print("")
  22.  
  23. if guessed_time == target_time:
  24.   print("yabadabdoo")
  25. elif guessed_time < target_time:
  26.   print("boo hoo not long enough")
  27. else:
  28.   print("You guessed too high")
  29.  
  30. print("")
  31. print("Statistics follow")
  32. print("start time was at:- ", start)
  33. print("end time was at:- ", end)
  34. print("You guessed:", guessed_time)
  35. print("Target time was", target_time)
  36.  
RAW Paste Data