mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 06:25:23 +01:00
Create complementary_and_supplementary_angle.py (#399)
* Create complementary_and_supplementary_angle.py * Update complementary_and_supplementary_angle.py Co-authored-by: Luke Weiler <lukew25073@gmail.com>
This commit is contained in:
committed by
GitHub
parent
471337aac5
commit
e7fa007c96
@@ -0,0 +1,26 @@
|
|||||||
|
from ...generator import Generator
|
||||||
|
import random
|
||||||
|
|
||||||
|
|
||||||
|
def gen_func(maxSupp=180, maxComp=90, format='string'):
|
||||||
|
angleType = random.choice(["supplementary", "complementary"])
|
||||||
|
|
||||||
|
if angleType == "supplementary":
|
||||||
|
angle = random.randint(1, maxSupp)
|
||||||
|
angleAns = 180 - angle
|
||||||
|
else:
|
||||||
|
angle = random.randint(1, maxComp)
|
||||||
|
angleAns = 90 - angle
|
||||||
|
|
||||||
|
if format == 'string':
|
||||||
|
problem = f"The {angleType} angle of {angle} ="
|
||||||
|
solution = angleAns
|
||||||
|
return problem, solution
|
||||||
|
elif format == 'latex':
|
||||||
|
return "Latex unavailable"
|
||||||
|
else:
|
||||||
|
return angleType, angle, angleAns
|
||||||
|
|
||||||
|
|
||||||
|
complementary_and_supplementary_angle = Generator("Complementary and Supplementary Angle", 112,
|
||||||
|
gen_func, ["maxSupp=180", "maxComp=90"])
|
||||||
Reference in New Issue
Block a user