Advertisement
JumpYScriptsz

Multiplication questions

Jun 20th, 2021 (edited)
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.71 KB | None | 0 0
  1. # ==== Credit and information ==== #
  2.  
  3. import random
  4.  
  5. # CREATOR: https://pastebin.com/u/JumpYScriptsz
  6. # STATUS: finished!
  7. # check here for updates: https://pastebin.com/M7M7uwe5
  8.  
  9. # new version out with devide and more questions
  10.  
  11. # ====== ERRORS ====== #
  12.  
  13. # -number of goes have to be above 0
  14. # -custom questions (range) can be broken sometimes with ranging between 2 numbers
  15. # -the "MODES" have to be typed exactly as they are written
  16.  
  17. # variables #
  18.  
  19. correct = 0
  20. incorrect = 0
  21. points = 0
  22.  
  23. # main settings / modification #
  24.  
  25. v = int(input("how many goes do you want: "))
  26. print("what mode do you want: ")
  27. print()
  28. print("======= MODES =======")
  29. print("easy")
  30. print("normal")
  31. print("hard")
  32. print("EXTREME")
  33. print("INSANE")
  34. print("custom")
  35. print()
  36. r = input(": ")
  37.  
  38. # change the v numbers to what fits you
  39.  
  40. if r == "easy": # e.g. 2 * 5
  41.     v1 = 1 # from range 1
  42.     v2 = 5 # to 5
  43.     v3 = 1 # second range
  44.     v4 = 5 # to 5
  45. elif r == "normal":
  46.     v1 = 2
  47.     v2 = 9
  48.     v3 = 2
  49.     fv4 = 12
  50. elif r == "hard":
  51.     v1 = -8
  52.     v2 = 13
  53.     v3 = -8
  54.     v4 = 12
  55. elif r == "EXTREME":
  56.     v1 = -14
  57.     v2 = 13
  58.     v3 = -6
  59.     v4 = 13
  60. elif r == "INSANE":
  61.     v1 = -20
  62.     v2 = 15
  63.     v3 = -30
  64.     v4 = 30
  65. elif r == "custom":
  66.     v1 = int(input("enter the first number range: "))
  67.     v2 = int(input("enter the second number range: "))
  68.     v3 = int(input("enter a lower number than your first number: "))
  69.     v4 = int(input("enter the second number range: "))
  70. else:
  71.     print("not valid mode - restart the program")
  72. y = input("show answer? DISABLED D / ENABLED E: ") # type D or E to disable / enable this
  73.  
  74. # random multiplication questions
  75.  
  76. for t in range(1, 1+v):
  77.     number = random.randint(v1, v2)
  78.     number2 = random.randint(v3, v4)
  79.     correctAnswer = number*number2
  80.    
  81.     print(number, "x", number2)
  82.     i = int(input(""))
  83.     if i == correctAnswer:
  84.         if y == "E":
  85.             print("")
  86.             correct = correct + 1
  87.             points = points + 225
  88.         else:
  89.             print("correct!")
  90.             correct = correct + 1
  91.             points = points + 115
  92.     elif i != correctAnswer:
  93.         if y == "E":
  94.             print("")
  95.             incorrect = incorrect + 1
  96.         else:
  97.             print("incorrect answer! answer is", correctAnswer)
  98.             incorrect = incorrect + 1
  99.     else:
  100.         print("error occured")
  101.  
  102. # statistics #
  103.        
  104. questions = correct + incorrect
  105. total = correct / questions * 100
  106.  
  107. print()
  108. print("======= STATISTICS =======")
  109. print()
  110. print("correct answers:", correct)
  111. print("incorrect answers:", incorrect)
  112. print("Total points gained:", points)
  113. print("number of goes:", v)
  114. print()
  115. print("ACCURACY:", total, "%")
  116.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement