import random
num1 = random.randint(1, 12)
num2 = random.randint(1, 12)
while True:
print('Choose 1 for Divison')
print("Choose 2 for Subtract")
mode = eval(input('enter number :'))
if (mode == 1):
if num1 < num2:
num1, num2 = num2, num1
for i in range(5):
num1 = random.randint(1, 12)
num2 = random.randint(1, 12)
x = eval(input(" what is " + str(num1) + " / " + str(num2) + " : "))
if x == (num1 // num2):
print(" Right, the result of the question " + str(num1) + " / " + str(num2) + " = ", x)
elif x != (num1 // num2):
print(" You are wrong Because " + str(num1) + "/" + str(num2) + " = ", (num1 // num2))
Again = input("If you want to stop write stop Or if you want to continue, type yes : ")
if (Again == "stop"):
break
elif (mode == 2):
for i in range(5):
num1 = random.randint(1, 12)
num2 = random.randint(1, 12)
if num1 < num2:
num1, num2 = num2, num1
y = eval(input(" what is " + str(num1) + " - " + str(num2) + ":"))
if y == (num1 - num2):
print(" Right, the result of the question " + str(num1) + " - " + str(num2) + " = ", y)
elif y != (num1 - num2):
print(" You are wrong Because " + str(num1) + " - " + str(num2) + " = ", (num1 - num2))
Again = input("If you want to stop write stop Or if you want to continue, type yes : ")
if (Again == "stop"):
break
else:
print('You have entered an invalid value!')
break
سويت كذا مره اشتغل معي الكود بعدها صار يطلعلي خطا هل فيه مشكلة في الكود ولا صحيح