Merge pull request #64 from lusifer65/patch-2

Update mathgen.py
This commit is contained in:
Luke Weiler
2020-10-15 20:01:47 -04:00
committed by GitHub

View File

@@ -239,6 +239,15 @@ def isTriangleValidFunc(maxSideLength = 50):
return problem, solution return problem, solution
solution = "No" solution = "No"
return problem, solution return problem, solution
def MidPointOfTwoPointFunc(maxValue=20):
x1=random.randint(-20,maxValue)
y1=random.randint(-20,maxValue)
x2=random.randint(-20,maxValue)
y2=random.randint(-20,maxValue)
problem=f"({x1},{y1}),({x2},{y2})="
solution=f"({(x1+x2)/2},{(y1+y2)/2})"
return problem,solution
# || Class Instances # || Class Instances
#Format is: #Format is:
@@ -263,3 +272,4 @@ fractionDivision = Generator("Fraction Division", 16, "(a/b)/(c/d)=", "x/y", div
intMatrix22Multiplication = Generator("Integer Multiplication with 2x2 Matrix", 17, "k * [[a,b],[c,d]]=", "[[k*a,k*b],[k*c,k*d]]", multiplyIntToMatrix22) intMatrix22Multiplication = Generator("Integer Multiplication with 2x2 Matrix", 17, "k * [[a,b],[c,d]]=", "[[k*a,k*b],[k*c,k*d]]", multiplyIntToMatrix22)
areaOfTriangle = Generator("Area of Triangle", 18, "Area of Triangle with side lengths a, b, c = ", "area", areaOfTriangleFunc) areaOfTriangle = Generator("Area of Triangle", 18, "Area of Triangle with side lengths a, b, c = ", "area", areaOfTriangleFunc)
doesTriangleExist = Generator("Triangle exists check", 19, "Does triangle with sides a, b and c exist?","Yes/No", isTriangleValidFunc) doesTriangleExist = Generator("Triangle exists check", 19, "Does triangle with sides a, b and c exist?","Yes/No", isTriangleValidFunc)
midPointOfTwoPoint=Generator("Midpoint of the two point", 20,"((X1,Y1),(X2,Y2))=","((X1+X2)/2,(Y1+Y2)/2)",MidPointOfTwoPointFunc)