Merge pull request #184 from SunTzunami/master

Rectified the "fourthAngleOfQuadriFunc" function to generate angles for convex quadrilaterals as well.
This commit is contained in:
Luke Weiler
2020-10-18 22:51:38 -04:00
committed by GitHub

View File

@@ -769,18 +769,23 @@ def powerRuleIntegrationFunc(maxCoef=10, maxExp=10, maxTerms=5):
solution = solution + " + c" solution = solution + " + c"
return problem, solution return problem, solution
def fourthAngleOfQuadriFunc(total=360):
def fourthAngleOfQuadriFunc(maxAngle=180): def rand_anglesquad():
angle1 = random.randint(1, maxAngle) a=180
angle2 = random.randint(1, 240 - angle1) b=0
angle3 = random.randint(1, 340 - (angle1 + angle2)) c=0
sum_ = angle1 + angle2 + angle3 d=0
angle4 = 360 - sum_ while(c==0 or d==0):
problem = f"Fourth angle of quadrilateral with angles {angle1} , {angle2}, {angle3} =" a=random.randint(1, total-20)
solution = angle4 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 return problem, solution
def quadraticEquation(maxVal=100): def quadraticEquation(maxVal=100):
a = random.randint(1, maxVal) a = random.randint(1, maxVal)
c = 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'): def surfaceAreaSphere(maxSide=20, unit='m'):
r = random.randint(1, maxSide) r = random.randint(1, maxSide)
problem = f"Surface area of Sphere with radius = {r}{unit} is" problem = f"Surface area of Sphere with radius = {r}{unit} is"
ans = 4 * math.pi * r * r ans = 4 * math.pi * r * r
solution = f"{ans} {unit}^2" 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) "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) 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) profitLossPercent = Generator("Profit or Loss Percent", 61, "Profit/ Loss percent when CP = cp and SP = sp is: ", "percent", profitLossPercentFunc)