diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 35c3e28..6598d77 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -370,7 +370,7 @@ def linearEquationsFunc(n = 2, varRange = 20, coeffRange = 20): problem = "\n".join(problem) return problem, solution -def primeFactors(minVal=1, maxVal=200): +def primeFactorsFunc(minVal=1, maxVal=200): a = random.randint(minVal, maxVal) n = a i = 2 @@ -410,6 +410,13 @@ def multiplyFractionsFunc(maxVal=10): solution = x return problem, solution +def regularPolygonAngleFunc(minVal = 3,maxVal = 20): + sideNum = random.randint(minVal, maxVal) + problem = f"Find the angle of a regular polygon with {sideNum} sides" + exteriorAngle = round((360/sideNum),2) + solution = 180 - exteriorAngle + return problem, solution + # || Class Instances #Format is: @@ -442,5 +449,6 @@ systemOfEquations = Generator("Solve a System of Equations in R^2", 23, "2x + 5y distance2Point = Generator("Distance between 2 points", 24, "Find the distance between (x1,y1) and (x2,y2)","sqrt(distanceSquared)", distanceTwoPointsFunc) pythagoreanTheorem = Generator("Pythagorean Theorem", 25, "The hypotenuse of a right triangle given the other two lengths a and b = ", "hypotenuse", pythagoreanTheoremFunc) linearEquations = Generator("Linear Equations", 26, "2x+5y=20 & 3x+6y=12", "x=-20 & y=12", linearEquationsFunc) #This has multiple variables whereas #23 has only x and y -primeFactors = Generator("Prime Factorisation", 27, "Prime Factors of a =", "[b, c, d, ...]", primeFactors) -fractionMultiplication = Generator("Fraction Multiplication", 28, "(a/b)*(c/d)=", "x/y", multiplyFractionsFunc) \ No newline at end of file +primeFactors = Generator("Prime Factorisation", 27, "Prime Factors of a =", "[b, c, d, ...]", primeFactorsFunc) +fractionMultiplication = Generator("Fraction Multiplication", 28, "(a/b)*(c/d)=", "x/y", multiplyFractionsFunc) +angleRegularPolygon = Generator("Angle of a Regular Polygon",29,"Find the angle of a regular polygon with 6 sides","120",regularPolygonAngleFunc) \ No newline at end of file