Add Area Of Trapezoid (#419)

* Added area_of_trapezoid.

* Fixed spacing in file.

* Move area of trapezoid to latest gen_list

---------

Co-authored-by: Luke Weiler <lukew25073@gmail.com>
This commit is contained in:
Nic Bestauros
2023-06-02 07:21:40 -07:00
committed by GitHub
parent 6d0841ef24
commit 4212e23ada
2 changed files with 19 additions and 0 deletions

View File

@@ -128,4 +128,5 @@ gen_list = [
("simplify_square_root", "basic_math"), ("simplify_square_root", "basic_math"),
("line_equation_from_2_points", "algebra"), ("line_equation_from_2_points", "algebra"),
("orthogonal_projection", "algebra"), ("orthogonal_projection", "algebra"),
("area_of_trapezoid", "geometry"),
] ]

View File

@@ -104,6 +104,24 @@ def area_of_circle_given_center_and_point(max_coordinate=10, max_radius=10):
return problem, f'${area}$' return problem, f'${area}$'
def area_of_trapezoid(max_len=20):
r"""Area of Trapezoid
| Ex. Problem | Ex. Solution |
| --- | --- |
| Area of trapezoid with height $12$ and base lengths: $3, 7, = $ | $60$ |
"""
a = random.randint(1, max_len)
b = random.randint(1, max_len)
h = random.randint(1, max_len)
area = (a + b) * h / 2
problem = f"Area of trapezoid with height ${h}$ and base lengths: ${a}, {b}, = $"
solution = f'${round(area, 2)}$'
return problem, solution
def area_of_triangle(max_a=20, max_b=20): def area_of_triangle(max_a=20, max_b=20):
r"""Area of Triangle r"""Area of Triangle