#Mohamed Ahmed import random num1 = random.randint(1,10) num2 = random.randint(1,10) questionChoice = random.randint(1,4) computerAnswer = 0 def cleanDivide(num1, num2): computerAnswer = 0 if num1 % num2 == 0: print("clean divide") print(num1, "/", num2, "= ?") computerAnswer = num1 / num2 return else: computerAnswer = 0 print("does not divide cleanly") print(num1, "and", num2, "did not divide cleanly.") while num1 % num2 != 0: num1 = random.randint(1,10) num2 = random.randint(1,10) computerAnswer = num1 / num2 int(computerAnswer) print(num1, "/", num2, "= ?") return questionNumber = 1 print("Welcome to Brain Training.") print("You will be asked any amount of questions.") questionCount = int(input("How many questions do you want?")) name = input("Enter your name - ") nick = input("What is your nick name - ") print("Ok", name) print("But I will call you", nick) while questionNumber <= questionCount: print("Question", questionNumber) if questionChoice == 1: print(num1, "+", num2, "= ?") computerAnswer = num1 + num2 elif questionChoice == 2: print(num1, "-", num2, "= ?") computerAnswer = num1 - num2 elif questionChoice == 3: print(num1, "*", num2, "= ?") computerAnswer = num1 * num2 else: cleanDivide(num1, num2) computerAnswer= num1 / num2 if num1 % num2 != 0: num1 = random.randint(1,10) num2 = random.randint(1,10) computerAnswer= num1 / num2 int(computerAnswer) answer = int(input("What is your answer?")) if answer == computerAnswer: print("correct") else: print("incorrect") num1 = random.randint(1,10) num2 = random.randint(1,10) questionChoice = random.randint(1,4) questionNumber = questionNumber + 1