From dc45a4be8d9dc4a26f98bf51a337d1d3016002a0 Mon Sep 17 00:00:00 2001 From: Akash verma <42277681+lusifer65@users.noreply.github.com> Date: Thu, 15 Oct 2020 15:40:50 -0400 Subject: [PATCH] Update mathgen.py midPointOfTwoPoint=Generator("Midpoint of the two point",18,"((X1,Y1),(X2,Y2))=","((X1+X2)/2,(Y1+Y2)/2)",MidPointOfTwoPoint) --- mathgenerator/mathgen.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index e9987ad..e17b369 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -215,6 +215,14 @@ def multiplyIntToMatrix22(maxMatrixVal = 10, maxRes = 100): problem = f"{constant} * [[{a}, {b}], [{c}, {d}]] = " solution = f"[[{a*constant},{b*constant}],[{c*constant},{d*constant}]]" return problem, solution +def MidPointOfTwoPoint(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 @@ -238,4 +246,5 @@ intDivision = Generator("Easy Division", 13,"a/b=","c",divisionToIntFunc) decimalToBinary = Generator("Decimal to Binary",14,"Binary of a=","b",DecimalToBinaryFunc) binaryToDecimal = Generator("Binary to Decimal",15,"Decimal of a=","b",BinaryToDecimalFunc) fractionDivision = Generator("Fraction Division", 16, "(a/b)/(c/d)=", "x/y", divideFractionsFunc) -intMatrix22Multiplication = Generator("Integer Multiplication with 2x2 Matrix", 17, "k * [[a,b],[c,d]]=", "[[k*a,k*b],[k*c,k*d]]", multiplyIntToMatrix22) \ No newline at end of file +intMatrix22Multiplication = Generator("Integer Multiplication with 2x2 Matrix", 17, "k * [[a,b],[c,d]]=", "[[k*a,k*b],[k*c,k*d]]", multiplyIntToMatrix22) +midPointOfTwoPoint=Generator("Midpoint of the two point",18,"((X1,Y1),(X2,Y2))=","((X1+X2)/2,(Y1+Y2)/2)",MidPointOfTwoPoint)