mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 06:25:23 +01:00
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:
@@ -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"),
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user