I have to random number generators and I am trying to make a simple division test. I can't figure out how to make num2 and factor of num1 so I don't get a decimal as the answer.
I have tried to make a factor number generator that if num2 wasn't a factor of num1 it go back to the random number generator. here is the link https://replit.com/@Thom08/stuff4#main.py
import random
import replit
from csinsc import *
import math
def add(num1,num2):
return num1 + num2
def subtract(num1,num2):
return num1 - num2
def multiply(num1,num2):
return num1 * num2
def divide(num1,num2):
return num1 / num2
label .startstart
score = 0
amount = 0
label .start
if amount != 10:
def multiply(num1,num2):
return num1 * num2
num1 = random.randint(1,10)
num2 = random.randint(1,10)
if num1 < num2:
goto .start
print("what is ", num1 ,'÷', num2,)
p = int(input("ANSWER: "))
a = divide(num1,num2)
if p == a:
print("CORRECT")
score = score + 1
amount = amount + 1
print("Your score is ", score , "/10")
input("press enter to continue")
replit.clear()
goto .start
else:
print("INCORRECT")
print("Your score is ", score , "/10")
amount = amount + 1
input("press ENTER to continue")
replit.clear()
goto .start
print("Congratulations, you finished the test")
print("Your score was ", score, "/10")
print("Would you like to do the test again")
answer = input("Type 'yes' or 'no': ")
if answer == "yes":
replit.clear()
goto .startstart
if answer == "no":
print("BYE")
else:
print("Could not compute")
print("ID10T Error")