diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index a11c3e0..778579e 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -769,18 +769,23 @@ def powerRuleIntegrationFunc(maxCoef=10, maxExp=10, maxTerms=5): solution = solution + " + c" return problem, solution - -def fourthAngleOfQuadriFunc(maxAngle=180): - angle1 = random.randint(1, maxAngle) - angle2 = random.randint(1, 240 - angle1) - angle3 = random.randint(1, 340 - (angle1 + angle2)) - sum_ = angle1 + angle2 + angle3 - angle4 = 360 - sum_ - problem = f"Fourth angle of quadrilateral with angles {angle1} , {angle2}, {angle3} =" - solution = angle4 +def fourthAngleOfQuadriFunc(total=360): + def rand_anglesquad(): + a=180 + b=0 + c=0 + d=0 + while(c==0 or d==0): + a=random.randint(1, total-20) + b=random.randint(1, total-a-10) + c=random.randint(1, total-a-b) + d=total-a-b-c + return a, b, c, d + a, b, c, d=rand_anglesquad() + problem="Fourth angle of a quadrilateral with three angles {}, {}, {} (in degrees)".format(a, b, c) + solution=d return problem, solution - def quadraticEquation(maxVal=100): a = random.randint(1, maxVal) c = random.randint(1, maxVal) @@ -940,7 +945,6 @@ def dataSummaryFunc(number_values=15, minval=5, maxval=50): def surfaceAreaSphere(maxSide=20, unit='m'): r = random.randint(1, maxSide) - problem = f"Surface area of Sphere with radius = {r}{unit} is" ans = 4 * math.pi * r * r solution = f"{ans} {unit}^2" @@ -1103,4 +1107,4 @@ volumeSphere = Generator("Volume of Sphere", 60, "Volume of sphere with radius r m = ", "(4*pi/3)*r*r*r", volumeSphereFunc) nthFibonacciNumberGen = Generator("nth Fibonacci number", 61, "What is the nth Fibonacci number", "Fn", nthFibonacciNumber) -profitLossPercent = Generator("Profit or Loss Percent", 61, "Profit/ Loss percent when CP = cp and SP = sp is: ", "percent", profitLossPercentFunc) \ No newline at end of file +profitLossPercent = Generator("Profit or Loss Percent", 61, "Profit/ Loss percent when CP = cp and SP = sp is: ", "percent", profitLossPercentFunc)