Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. import time
  2. import functools
  3. import operator
  4. import random
  5. import math
  6.  
  7. print('Number Time quiz!')
  8. time.sleep(2)
  9. print('Answer the multiplcation problems before time runs out!')
  10. time.sleep(3)
  11. print('Ready? Go!')
  12. start_time = time.time()
  13.  
  14. score = 0
  15.  
  16. # Game Logic
  17.  
  18. while True:
  19. difficulty_setting = 2
  20. difficulty_progression = math.floor(score/10)
  21. overall_difficulty = difficulty_setting + difficulty_progression
  22.  
  23. numbers_list = []
  24. for x in range(overall_difficulty):
  25. value = random.randint(1,9)
  26. numbers_list.append(value)
  27.  
  28. answer = functools.reduce(operator.mul, numbers_list, 1)
  29. print('Multiple these numbers', numbers_list)
  30.  
  31. guess = int(input())
  32.  
  33. if guess == answer:
  34. score = score + (1 * overall_difficulty)
  35. continue
  36.  
  37. else:
  38. print('Game over! The answer was', answer)
  39. elapsed_time = time.time() - start_time
  40. print('Your score was', score, 'In only', elapsed_time)
  41. break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement