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:
Muhammad Al Atiqi
2022-12-21 04:20:58 +07:00
committed by GitHub
parent 471337aac5
commit e7fa007c96

View File

@@ -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"])