mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 06:25:23 +01:00
Added Compare Fractions Generator
This commit is contained in:
BIN
mathgenerator/__pycache__/__init__.cpython-37.pyc
Normal file
BIN
mathgenerator/__pycache__/__init__.cpython-37.pyc
Normal file
Binary file not shown.
BIN
mathgenerator/__pycache__/mathgen.cpython-37.pyc
Normal file
BIN
mathgenerator/__pycache__/mathgen.cpython-37.pyc
Normal file
Binary file not shown.
@@ -464,6 +464,31 @@ def commonFactorsFunc(maxVal=100):
|
||||
problem = f"Common Factors of {a} and {b} = "
|
||||
solution = arr
|
||||
return problem, solution
|
||||
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}?\n"
|
||||
return problem,solution
|
||||
|
||||
|
||||
# || Class Instances
|
||||
|
||||
#Format is:
|
||||
@@ -502,3 +527,4 @@ angleRegularPolygon = Generator("Angle of a Regular Polygon",29,"Find the angle
|
||||
combinations = Generator("Combinations of Objects",30, "Combinations available for picking 4 objects at a time from 6 distinct objects ="," 15", combinationsFunc)
|
||||
factorial = Generator("Factorial", 31, "a! = ", "b", factorialFunc)
|
||||
commonFactors = Generator("Common Factors", 32, "Common Factors of {a} and {b} = ","[c, d, ...]",commonFactorsFunc)
|
||||
compareFractions=Generator("Compare Fractions",33,"Which symbol represents the comparison between a/b and c/d?",">/</=",compareFractionsFunc)
|
||||
|
||||
Reference in New Issue
Block a user