Files
mathgenerator/mathgenerator/funcs/compareFractionsFunc.py

27 lines
607 B
Python

from .__init__ import *
def compareFractionsFunc(maxVal=10):
a = random.randint(1, maxVal)
b = random.randint(1, maxVal)
c = random.randint(1, maxVal)
d = random.randint(1, maxVal)
while (a == b):
b = random.randint(1, maxVal)
while (c == d):
d = random.randint(1, maxVal)
first = a / b
second = c / d
if(first > second):
solution = ">"
elif(first < second):
solution = "<"
else:
solution = "="
problem = f"Which symbol represents the comparison between {a}/{b} and {c}/{d}?"
return problem, solution