Question: Area of a Rectangle - rectangle_area This function returns the area of the rectangle with given base and height area = base * height

Area of a Rectangle - rectangle_area\ This function returns the area of the rectangle with given base and height\

area = base * height

\ Area of a Triangle - triangle_area\ This function returns the area of three given triangle side lengths calculated according to Heron's formula\ (calculate the semiperimeter first, then use that to calculate the area):\

s=(a+b+c)/(2)\ area =\\\\sqrt(s*(s-a)*(s-b)*(s-c))

\ Do not use any built-in method or function for any Python library. Remember that roots are the opposite\ of an exponent. So you can calculate the square root of a number by using the exponent form

n^((1)/(2))

.\ Area of a Trapezoid - trapezoid_area\ This function returns the area of the trapezoid with given base_1, base_2, and height.\

area =(1)/(2)*( base _((

)

1)+ base _((

)

2))* height

\ Area of a Circle - circle_area\ This function returns the area of the circle with the given radius, rounded at two decimal places. Use\ the value 3.1415 for

\\\\pi

.\

area =\\\\pi * radius ^((

)

2)

\ Any area - calculate_area\ This function calls the other functions, based on a string argument: "rectangle", "triangle", or\ "circle". It returns a string that looks like this:\ The area of the triangle is 6.0\ This function takes a total of four arguments, the first one is a string that tells the function which area to\ calculate, and the three other parameters are numeric. In the case of the circle, for example, only the first\ numeric argument is used.\ Test cases\ def main():\ print( rectangle_area(4, 4.5) ) # 18.0\ print( triangle_area(

3,4,5

) ) # 6.0\ print( trapezoid_area(4, 20, 10) ) # 120.0\ assert circle_area

(20)==1256.6

\ message

=

calculate_area("trapezoid", 11, 25, 5)\ print(message) # "The area of the trapezoid is

90.0

\ message = calculate_area("circle", 4, 0, 0)\ print(messagege) # "The area of the circle is 50.26"\ main( )

 Area of a Rectangle - rectangle_area\ This function returns the area

This function returns the area of the rectangle with given and height area=baseheight Area of a Triangle - triangle_area This function returns the area of three given triangle side lengths calculated according to Heron's formula (calculate the semiperimeter first, then use that to calculate the area): s=(a+b+c)/2area=s(sa)(sb)(sc) Do not use any built-in method or function for any Python library. Remember that roots are the opposite of an exponent. So you can calculate the square root of a number by using the exponent form n1/2. Area of a Trapezoid - trapezoid_area This function returns the area of the trapezoid with given base_1, base_2, and height . area=1/2(base1+base2)height Area of a Circle - circle_area This function returns the area of the circle with the given rounded at two decimal places. Use the value 3.1415 for . area=radius2 Any area - calculate_area This function calls the other functions, based on a string argument: "rectangle", "triangle", or "circle". It returns a string that looks like this: The area of the triangle is 6.0 This function takes a total of four arguments, the first one is a string that tells the function which area to calculate, and the three other parameters are numeric. In the case of the circle, for example, only the first numeric argument is used

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!