Files
mathgenerator/mathgenerator/funcs/compareFractionsFunc.py
2020-10-19 20:33:18 -04:00

34 lines
797 B
Python

from .__init__ import *
from ..__init__ import Generator
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
compareFractions = Generator(
"Compare Fractions", 44,
"Which symbol represents the comparison between a/b and c/d?", ">/</=",
compareFractionsFunc)