Created
April 30, 2020 13:31
-
-
Save Raj39120/d84a36d242672919b5c89bc2a2b0c9d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import randrange | |
def addition_problems(): | |
a = randrange(0, 10, 1) | |
print(" " + str(a)) | |
print("+") | |
b = randrange(0, 10, 1) | |
print(" " + str(b)) | |
print("-----") | |
c = int(input("Enter the sum of the two numbers above over here: ")) | |
if c == a + b: | |
print("GOOD JOB, YOU GOT IT CORRECT") | |
if c != a + b: | |
print("SORRY, YOU GOT IT INCORRECT. THE CORRECT ANSWER IS BELOW.") | |
print(a + b) | |
print("YOUR SCORE IS 0/10") | |
print("PLEASE TRY AGAIN.") | |
return | |
d = randrange(0, 100, 1) | |
print(" " + str(d)) | |
print("+") | |
e = randrange(0, 100, 1) | |
print(" " + str(e)) | |
print("-----") | |
f = int(input("Enter the sum of the two numbers above over here: ")) | |
if f == d + e: | |
print("GOOD JOB, YOU GOT IT CORRECT") | |
if f != d + e: | |
print("SORRY, YOU GOT IT INCORRECT. THE CORRECT ANSWER IS BELOW.") | |
print(d + e) | |
print("YOUR SCORE IS 1/10") | |
print("PLEASE TRY AGAIN.") | |
return | |
g = randrange(0, 1000, 1) | |
print(" " + str(g)) | |
print("+") | |
h = randrange(0, 1000, 1) | |
print(" " + str(h)) | |
print("-----") | |
i = int(input("Enter the sum of the two numbers above over here: ")) | |
if i == g + h: | |
print("GOOD JOB, YOU GOT IT CORRECT") | |
if i != g + h: | |
print("SORRY, YOU GOT IT INCORRECT. THE CORRECT ANSWER IS BELOW.") | |
print(g + h) | |
print("YOUR SCORE IS 2/10") | |
print("PLEASE TRY AGAIN.") | |
return | |
j = randrange(0, 10000, 1) | |
print(" " + str(j)) | |
print("+") | |
k = randrange(0, 10000, 1) | |
print(" " + str(k)) | |
print("-----") | |
z = int(input("Enter the sum of the two numbers above over here: ")) | |
if z == j + k: | |
print("GOOD JOB, YOU GOT IT CORRECT") | |
if z != j + k: | |
print("SORRY, YOU GOT IT INCORRECT. THE CORRECT ANSWER IS BELOW.") | |
print(j + k) | |
print("YOUR SCORE IS 3/10") | |
print("PLEASE TRY AGAIN.") | |
return | |
m = randrange(0, 100000, 1) | |
print(" " + str(m)) | |
print("+") | |
n = randrange(0, 100000, 1) | |
print(" " + str(n)) | |
print("-----") | |
o = int(input("Enter the sum of the two numbers above over here: ")) | |
if o == m + n: | |
print("GOOD JOB, YOU GOT IT CORRECT") | |
if o != m + n: | |
print("SORRY, YOU GOT IT INCORRECT. THE CORRECT ANSWER IS BELOW.") | |
print(m + n) | |
print("YOUR SCORE IS 4/10") | |
print("PLEASE TRY AGAIN.") | |
return | |
p = randrange(0, 1000000, 1) | |
print(" " + str(p)) | |
print("+") | |
q = randrange(0, 1000000, 1) | |
print(" " + str(q)) | |
print("-----") | |
r = int(input("Enter the sum of the two numbers above over here: ")) | |
if r == p + q: | |
print("GOOD JOB, YOU GOT IT CORRECT") | |
if r != p + q: | |
print("SORRY, YOU GOT IT INCORRECT. THE CORRECT ANSWER IS BELOW.") | |
print(p + q) | |
print("YOUR SCORE IS 5/10") | |
print("PLEASE TRY AGAIN.") | |
return | |
s = randrange(0, 10000000, 1) | |
print(" " + str(s)) | |
print("+") | |
t = randrange(0, 10000000, 1) | |
print(" " + str(t)) | |
print("-----") | |
u = int(input("Enter the sum of the two numbers above over here: ")) | |
if u == s + t: | |
print("GOOD JOB, YOU GOT IT CORRECT") | |
if u != s + t: | |
print("SORRY, YOU GOT IT INCORRECT. THE CORRECT ANSWER IS BELOW.") | |
print(s + t) | |
print("YOUR SCORE IS 6/10") | |
print("PLEASE TRY AGAIN.") | |
return | |
v = randrange(1000, 10000, 1) | |
print(" " + str(v)) | |
print("+") | |
w = randrange(0, 1000, 1) | |
print(" " + str(w)) | |
print("-----") | |
x = int(input("Enter the sum of the two numbers above over here: ")) | |
if x == v + w: | |
print("GOOD JOB, YOU GOT IT CORRECT") | |
if x != v + w: | |
print("SORRY, YOU GOT IT INCORRECT. THE CORRECT ANSWER IS BELOW.") | |
print(v + w) | |
print("YOUR SCORE IS 7/10") | |
print("PLEASE TRY AGAIN.") | |
return | |
y = randrange(100, 1000, 1) | |
print(" " + str(y)) | |
print("+") | |
l_1 = randrange(1000, 10000, 1) | |
print(" " + str(l_1)) | |
print("-----") | |
l_2 = int(input("Enter the sum of the two numbers above over here: ")) | |
if l_2 == y + l_1: | |
print("GOOD JOB, YOU GOT IT CORRECT") | |
if l_2 != y + l_1: | |
print("SORRY, YOU GOT IT INCORRECT. THE CORRECT ANSWER IS BELOW.") | |
print(y + l_1) | |
print("YOUR SCORE IS 8/10") | |
print("PLEASE TRY AGAIN.") | |
return | |
e_1 = randrange(0, 1000, 1) | |
print(" " + str(e_1)) | |
print("+") | |
e_2 = randrange(1000, 100000, 1) | |
print(" " + str(e_2)) | |
print("-----") | |
e_3 = int(input("Enter the sum of the two numbers above over here: ")) | |
if e_3 == e_1 + e_2: | |
print("GOOD JOB, YOU GOT IT CORRECT") | |
print("YOUR SCORE IS 10/10") | |
print("PLAY AGAIN") | |
return | |
if e_3 != e_1 + e_2: | |
print("SORRY, YOU GOT IT INCORRECT. THE CORRECT ANSWER IS BELOW.") | |
print(e_1 + e_2) | |
print("YOUR SCORE IS 9/10") | |
print("PLEASE TRY AGAIN.") | |
return | |
def subtraction_problems(): | |
a = randrange(0, 10, 1) | |
print(" " + str(a)) | |
print("-") | |
b = randrange(0, 10, 1) | |
print(" " + str(b)) | |
print("-----") | |
c = int(input("Enter the difference of the two numbers above over here: ")) | |
if c == a - b: | |
print("GOOD JOB, YOU GOT IT CORRECT") | |
if c != a - b: | |
print("SORRY, YOU GOT IT INCORRECT. THE CORRECT ANSWER IS BELOW.") | |
print(a - b) | |
print("YOUR SCORE IS 0/10") | |
print("PLEASE TRY AGAIN") | |
return | |
d = randrange(0, 100, 1) | |
print(" " + str(d)) | |
print("-") | |
e = randrange(0, 100, 1) | |
print(" " + str(e)) | |
print("-----") | |
f = int(input("Enter the difference of the two numbers above over here: ")) | |
if f == d - e: | |
print("GOOD JOB, YOU GOT IT CORRECT") | |
if f != d - e: | |
print("SORRY, YOU GOT IT INCORRECT. THE CORRECT ANSWER IS BELOW.") | |
print(d - e) | |
print("YOUR SCORE IS 1/10") | |
print("PLEASE TRY AGAIN") | |
return | |
g = randrange(0, 1000, 1) | |
print(" " + str(g)) | |
print("-") | |
h = randrange(0, 1000, 1) | |
print(" " + str(h)) | |
print("-----") | |
i = int(input("Enter the difference of the two numbers above over here: ")) | |
if i == g - h: | |
print("GOOD JOB, YOU GOT IT CORRECT") | |
if i != g - h: | |
print("SORRY, YOU GOT IT INCORRECT. THE CORRECT ANSWER IS BELOW.") | |
print(g - h) | |
print("YOUR SCORE IS 2/10") | |
print("PLEASE TRY AGAIN") | |
return | |
j = randrange(0, 10000, 1) | |
print(" " + str(j)) | |
print("-") | |
k = randrange(0, 10000, 1) | |
print(" " + str(k)) | |
print("-----") | |
l_1 = int(input("Enter the difference of the two numbers above over here: ")) | |
if l_1 == j - k: | |
print("GOOD JOB, YOU GOT IT CORRECT") | |
if l_1 != j - k: | |
print("SORRY, YOU GOT IT INCORRECT. THE CORRECT ANSWER IS BELOW.") | |
print(j - k) | |
print("YOUR SCORE IS 3/10") | |
print("PLEASE TRY AGAIN") | |
return | |
m = randrange(0, 100000, 1) | |
print(" " + str(m)) | |
print("-") | |
n = randrange(0, 100000, 1) | |
print(" " + str(n)) | |
print("-----") | |
o = int(input("Enter the difference of the two numbers above over here: ")) | |
if o == m - n: | |
print("GOOD JOB, YOU GOT IT CORRECT") | |
if o != m - n: | |
print("SORRY, YOU GOT IT INCORRECT. THE CORRECT ANSWER IS BELOW.") | |
print(m - n) | |
print("YOUR SCORE IS 4/10") | |
print("PLEASE TRY AGAIN") | |
return | |
p = randrange(0, 1000000, 1) | |
print(" " + str(p)) | |
print("-") | |
q = randrange(0, 1000000, 1) | |
print(" " + str(q)) | |
print("-----") | |
r = int(input("Enter the difference of the two numbers above over here: ")) | |
if r == p - q: | |
print("GOOD JOB, YOU GOT IT CORRECT") | |
if r != p - q: | |
print("SORRY, YOU GOT IT INCORRECT. THE CORRECT ANSWER IS BELOW.") | |
print(p - q) | |
print("YOUR SCORE IS 5/10") | |
print("PLEASE TRY AGAIN") | |
return | |
s = randrange(0, 100, 1) | |
print(" " + str(s)) | |
print("-") | |
t = randrange(0, 1000, 1) | |
print(" " + str(t)) | |
print("-----") | |
u = int(input("Enter the difference of the two numbers above over here: ")) | |
if u == s - t: | |
print("GOOD JOB, YOU GOT IT CORRECT") | |
if u != s - t: | |
print("SORRY, YOU GOT IT INCORRECT. THE CORRECT ANSWER IS BELOW.") | |
print(s - t) | |
print("YOUR SCORE IS 6/10") | |
print("PLEASE TRY AGAIN") | |
return | |
v = randrange(0, 1000, 1) | |
print(" " + str(v)) | |
print("-") | |
w = randrange(0, 10000, 1) | |
print(" " + str(w)) | |
print("-----") | |
x = int(input("Enter the difference of the two numbers above over here: ")) | |
if x == v - w: | |
print("GOOD JOB, YOU GOT IT CORRECT") | |
if x != v - w: | |
print("SORRY, YOU GOT IT INCORRECT. THE CORRECT ANSWER IS BELOW.") | |
print(v - w) | |
print("YOUR SCORE IS 7/10") | |
print("PLEASE TRY AGAIN") | |
return | |
y = randrange(0, 10000, 1) | |
print(" " + str(y)) | |
print("-") | |
z = randrange(0, 100000, 1) | |
print(" " + str(z)) | |
print("-----") | |
e_1 = int(input("Enter the difference of the two numbers above over here: ")) | |
if e_1 == y - z: | |
print("GOOD JOB, YOU GOT IT CORRECT") | |
if e_1 != y - z: | |
print("SORRY, YOU GOT IT INCORRECT. THE CORRECT ANSWER IS BELOW.") | |
print(y - z) | |
print("YOUR SCORE IS 8/10") | |
print("PLEASE TRY AGAIN") | |
return | |
e_2 = randrange(0, 100000, 1) | |
print(" " + str(e_2)) | |
print("-") | |
e_3 = randrange(0, 1000000, 1) | |
print(" " + str(e_3)) | |
print("-----") | |
e_4 = int(input("Enter the difference of the two numbers above over here: ")) | |
if e_4 == e_2 - e_3: | |
print("GOOD JOB, YOU GOT IT CORRECT") | |
if e_4 != e_2 - e_3: | |
print("SORRY, YOU GOT IT INCORRECT. THE CORRECT ANSWER IS BELOW.") | |
print("YOUR SCORE IS 10/10") | |
print(e_2 - e_3) | |
print("YOUR SCORE IS 9/10") | |
print("PLEASE TRY AGAIN") | |
return | |
def multiplication_problems(): | |
a = randrange(0, 10, 1) | |
print(" " + str(a)) | |
print("x") | |
b = randrange(0, 10, 1) | |
print(" " + str(b)) | |
print("-----") | |
c = int(input("Enter the product of the two numbers above over here: ")) | |
if c == a * b: | |
print("GOOD JOB, YOU GOT IT CORRECT") | |
if c != a * b: | |
print("SORRY, YOU GOT IT INCORRECT. THE CORRECT ANSWER IS BELOW.") | |
print(a * b) | |
print("YOUR SCORE IS 0/10") | |
print("PLEASE TRY AGAIN") | |
return | |
d = randrange(0, 100, 1) | |
print(" " + str(d)) | |
print("x") | |
e = randrange(0, 100, 1) | |
print(" " + str(e)) | |
print("-----") | |
f = int(input("Enter the product of the two numbers above over here: ")) | |
if f == d * e: | |
print("GOOD JOB, YOU GOT IT CORRECT") | |
if f != d * e: | |
print("SORRY, YOU GOT IT INCORRECT. THE CORRECT ANSWER IS BELOW.") | |
print(d * e) | |
print("YOUR SCORE IS 1/10") | |
print("PLEASE TRY AGAIN") | |
return | |
g = randrange(0, 1000, 1) | |
print(" " + str(g)) | |
print("x") | |
h = randrange(0, 1000, 1) | |
print(" " + str(h)) | |
print("-----") | |
i = int(input("Enter the product of the two numbers above over here: ")) | |
if i == g * h: | |
print("GOOD JOB, YOU GOT IT CORRECT") | |
if i != g * h: | |
print("SORRY, YOU GOT IT INCORRECT. THE CORRECT ANSWER IS BELOW.") | |
print(g * h) | |
print("YOUR SCORE IS 2/10") | |
print("PLEASE TRY AGAIN") | |
return | |
j = randrange(0, 10000, 1) | |
print(" " + str(j)) | |
print("x") | |
k = randrange(0, 10000, 1) | |
print(" " + str(k)) | |
print("-----") | |
l_1 = int(input("Enter the product of the two numbers above over here: ")) | |
if l_1 == j * k: | |
print("GOOD JOB, YOU GOT IT CORRECT") | |
if l_1 != j * k: | |
print("SORRY, YOU GOT IT INCORRECT. THE CORRECT ANSWER IS BELOW.") | |
print(j * k) | |
print("YOUR SCORE IS 3/10") | |
print("PLEASE TRY AGAIN") | |
return | |
m = randrange(0, 100000, 1) | |
print(" " + str(m)) | |
print("x") | |
n = randrange(0, 100000, 1) | |
print(" " + str(n)) | |
print("-----") | |
o = int(input("Enter the product of the two numbers above over here: ")) | |
if o == m * n: | |
print("GOOD JOB, YOU GOT IT CORRECT") | |
if o != m * n: | |
print("SORRY, YOU GOT IT INCORRECT. THE CORRECT ANSWER IS BELOW.") | |
print(m * n) | |
print("YOUR SCORE IS 4/10") | |
print("PLEASE TRY AGAIN") | |
return | |
p = randrange(0, 1000000, 1) | |
print(" " + str(p)) | |
print("x") | |
q = randrange(0, 1000000, 1) | |
print(" " + str(q)) | |
print("-----") | |
r = int(input("Enter the product of the two numbers above over here: ")) | |
if r == p * q: | |
print("GOOD JOB, YOU GOT IT CORRECT") | |
if r != p * q: | |
print("SORRY, YOU GOT IT INCORRECT. THE CORRECT ANSWER IS BELOW.") | |
print(p * q) | |
print("YOUR SCORE IS 5/10") | |
print("PLEASE TRY AGAIN") | |
return | |
s = randrange(0, 100, 1) | |
print(" " + str(s)) | |
print("x") | |
t = randrange(0, 1000, 1) | |
print(" " + str(t)) | |
print("-----") | |
u = int(input("Enter the product of the two numbers above over here: ")) | |
if u == s * t: | |
print("GOOD JOB, YOU GOT IT CORRECT") | |
if u != s * t: | |
print("SORRY, YOU GOT IT INCORRECT. THE CORRECT ANSWER IS BELOW.") | |
print(s * t) | |
print("YOUR SCORE IS 6/10") | |
print("PLEASE TRY AGAIN") | |
return | |
v = randrange(0, 1000, 1) | |
print(" " + str(v)) | |
print("x") | |
w = randrange(0, 10000, 1) | |
print(" " + str(w)) | |
print("-----") | |
x = int(input("Enter the product of the two numbers above over here: ")) | |
if x == v * w: | |
print("GOOD JOB, YOU GOT IT CORRECT") | |
if x != v * w: | |
print("SORRY, YOU GOT IT INCORRECT. THE CORRECT ANSWER IS BELOW.") | |
print(v * w) | |
print("YOUR SCORE IS 7/10") | |
print("PLEASE TRY AGAIN") | |
return | |
y = randrange(0, 10000, 1) | |
print(" " + str(y)) | |
print("x") | |
z = randrange(0, 100000, 1) | |
print(" " + str(z)) | |
print("-----") | |
e_1 = int(input("Enter the product of the two numbers above over here: ")) | |
if e_1 == y * z: | |
print("GOOD JOB, YOU GOT IT CORRECT") | |
if e_1 != y * z: | |
print("SORRY, YOU GOT IT INCORRECT. THE CORRECT ANSWER IS BELOW.") | |
print(y * z) | |
print("YOUR SCORE IS 8/10") | |
print("PLEASE TRY AGAIN") | |
return | |
e_2 = randrange(0, 100000, 1) | |
print(" " + str(e_2)) | |
print("x") | |
e_3 = randrange(0, 1000000, 1) | |
print(" " + str(e_3)) | |
print("-----") | |
e_4 = int(input("Enter the product of the two numbers above over here: ")) | |
if e_4 == e_2 * e_3: | |
print("GOOD JOB, YOU GOT IT CORRECT") | |
if e_4 != e_2 * e_3: | |
print("SORRY, YOU GOT IT INCORRECT. THE CORRECT ANSWER IS BELOW.") | |
print("YOUR SCORE IS 10/10") | |
print(e_2 * e_3) | |
print("YOUR SCORE IS 9/10") | |
print("PLEASE TRY AGAIN") | |
return | |
from Math_Problems import * | |
import time | |
print("This is a math quiz with 3 topics, each having 10 questions.") | |
time.sleep(2.0) | |
print("You can choose which topic you want to do.") | |
time.sleep(2.0) | |
print("Below, there is a list of the 3 topics, each with its own corresponding number.") | |
time.sleep(2.0) | |
print("Enter the number of the topic you want to do at the end.") | |
time.sleep(2.0) | |
print("GOOD LUCK!") | |
time.sleep(2.0) | |
print("1 = Addition Problems") | |
time.sleep(1.0) | |
print("2 = Subtraction Problems") | |
time.sleep(1.0) | |
print("3 = Multiplication Problems") | |
time.sleep(1.0) | |
choice = int(input("Enter the number corresponding to your choice here: ")) | |
if choice == 1: | |
addition_problems() | |
elif choice == 2: | |
subtraction_problems() | |
elif choice == 3: | |
multiplication_problems() | |
else: | |
print("Please enter valid choice.") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment