Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ==== Credit and information ==== #
- import random
- # CREATOR: https://pastebin.com/u/JumpYScriptsz
- # STATUS: working!
- # check here for updates: https://pastebin.com/sRKki8t9
- # welcome to Maths game v2!
- # ====== ERRORS ====== #
- # -number of goes have to be above 0
- # -custom questions (range) can be broken sometimes with ranging between 2 numbers
- # -the "MODES" have to be typed exactly as they are written
- # variables #
- correct = 0
- incorrect = 0
- points = 0
- # main settings / modification #
- print("what would you like to practice?")
- print()
- print("addition, +")
- print("subtraction, -")
- print("multiplication, *")
- print("powers, **")
- print()
- rr = input(": ")
- v = int(input("how many goes do you want: "))
- print("what mode do you want: ")
- print()
- print("======= MODES =======")
- print("easy")
- print("normal")
- print("hard")
- print("EXTREME")
- print("INSANE")
- print("custom")
- print()
- r = input(": ")
- if rr == "*":
- # change the v numbers to what fits you or leave them
- if r == "easy": # e.g. 2 * 5
- v1 = 1 # from range 1
- v2 = 5 # to 5
- v3 = 1 # second range
- v4 = 5 # to 5
- elif r == "normal":
- v1 = 2
- v2 = 9
- v3 = 2
- v4 = 12
- elif r == "hard":
- v1 = -8
- v2 = 13
- v3 = -8
- v4 = 12
- elif r == "EXTREME":
- v1 = -14
- v2 = 13
- v3 = -6
- v4 = 13
- elif r == "INSANE":
- v1 = -20
- v2 = 15
- v3 = -30
- v4 = 30
- elif r == "custom":
- v1 = int(input("enter the first number range: "))
- v2 = int(input("enter the second number range: "))
- v3 = int(input("enter a lower number than your first number: "))
- v4 = int(input("enter the second number range: "))
- else:
- print("not valid mode - restart the program")
- elif rr == "+":
- if r == "easy": # e.g. 2 + 5
- v1 = 1 # from range 1
- v2 = 10 # to 5
- v3 = 1 # second range
- v4 = 10 # to 5
- elif r == "normal":
- v1 = 5
- v2 = 50
- v3 = 5
- v4 = 50
- elif r == "hard":
- v1 = -20
- v2 = 20
- v3 = -20
- v4 = 20
- elif r == "EXTREME":
- v1 = -50
- v2 = 70
- v3 = -60
- v4 = 70
- elif r == "INSANE":
- v1 = -100
- v2 = 15
- v3 = -100
- v4 = 30
- elif r == "custom":
- v1 = int(input("enter the first number range: "))
- v2 = int(input("enter the second number range: "))
- v3 = int(input("enter a lower number than your first number: "))
- v4 = int(input("enter the second number range: "))
- else:
- print("not valid mode - restart the program")
- elif rr == "-":
- if r == "easy": # e.g. 2 - 5
- v1 = 1 # from range 1
- v2 = 5 # to 5
- v3 = 1 # second range
- v4 = 5 # to 5
- elif r == "normal":
- v1 = 2
- v2 = 30
- v3 = 2
- v4 = 30
- elif r == "hard":
- v1 = -10
- v2 = 50
- v3 = -10
- v4 = 50
- elif r == "EXTREME":
- v1 = -50
- v2 = 50
- v3 = -50
- v4 = 50
- elif r == "INSANE":
- v1 = -200
- v2 = 200
- v3 = -200
- v4 = 200
- elif r == "custom":
- v1 = int(input("enter the first number range: "))
- v2 = int(input("enter the second number range: "))
- v3 = int(input("enter a lower number than your first number: "))
- v4 = int(input("enter the second number range: "))
- else:
- print("not valid mode - restart the program")
- elif rr == "**":
- if r == "easy":
- v1 = 1
- v2 = 4
- v3 = 1
- v4 = 3
- elif r == "normal":
- v1 = 2
- v2 = 4
- v3 = 2
- v4 = 6
- elif r == "hard":
- v1 = -3
- v2 = 10
- v3 = -4
- v4 = 10
- elif r == "EXTREME":
- v1 = -12
- v2 = 6
- v3 = -12
- v4 = 8
- elif r == "INSANE":
- v1 = -20
- v2 = 25
- v3 = -20
- v4 = 25
- elif r == "custom":
- v1 = int(input("enter the first number range: "))
- v2 = int(input("enter the second number range: "))
- v3 = int(input("enter a lower number than your first number: "))
- v4 = int(input("enter the second number range: "))
- else:
- print("not valid mode - restart the program")
- y = input("show answer? DISABLED D / ENABLED E: ") # type D or E to disable / enable this
- # random multiplication questions
- for t in range(1, 1+v):
- number = random.randint(v1, v2)
- number2 = random.randint(v3, v4)
- if rr == "*":
- correctAnswer = number*number2
- print(number, "x", number2)
- elif rr == "+":
- correctAnswer = number+number2
- print(number, "+", number2)
- elif rr == "-":
- correctAnswer = number-number2
- print(number, "-", number2)
- elif rr == "**":
- correctAnswer = number**number2
- print(number, "by the power of", number2)
- i = int(input(""))
- if i == correctAnswer:
- if y == "E":
- print("")
- correct = correct + 1
- points = points + 225
- else:
- print("correct!")
- correct = correct + 1
- points = points + 115
- elif i != correctAnswer:
- if y == "E":
- print("")
- incorrect = incorrect + 1
- else:
- print("incorrect answer! answer is", correctAnswer)
- incorrect = incorrect + 1
- else:
- print("error occured")
- # statistics #
- questions = correct + incorrect
- total = correct / questions * 100
- print()
- print("======= STATISTICS =======")
- print()
- print("correct answers:", correct)
- print("incorrect answers:", incorrect)
- print("Total points gained:", points)
- print()
- print("number of goes input: ", v)
- print()
- print("ACCURACY:", total, "%")
Add Comment
Please, Sign In to add comment