Class07 Python Homework
Class07 Python Homework
The function is called from geometry_main.py, which prints the result rounded to two decimal
places:
Perform a web search or consult your geometry textbook for the required mathematical
formulae:
1. Add a new function named calculate_triangle_area that will return the area of a
triangle.
Call the function from geometry_main.py with height parameter set to 6.2, the base
parameter set to 3.5, and print the result.
2. Add a new function named calculate_circle_area that will return the area of a circle.
(π is defined by math.pi)
Call the function from geometry_main.py with radius parameter set to 4.8, and print the
result.
3. Add a new function named calculate_sphere_area that will return the surface area of a
sphere.
Call the function from geometry_main.py with the radius parameter set to 3.3, and print
the result
4. Add a new function named calculate_cuboid_volume that will return the volume of a
cuboid (also known as rectangular prism).
Call the function from geometry_main.py with length parameter set to 1.7, width
parameter set to 2.9, height parameter set to 4.3, and print the result.
1
5. Add a new function named calculate_sphere_volume that will return the volume of a
sphere.
Call the function from geometry_main.py with radius parameter set to 3.2, and print the
result.
6. Add a new function named calculate_cone_area that will return the surface area of a
cone.
Call the function from geometry_main.py with height parameter set to 5.3, the radius
parameter set to 2.5, and print the result
7. Add a new function named calculate_cone_volume that will return the volume of a
cone.
Call the function from geometry_main.py with height parameter set to 5.7, the radius
parameter set to 2.3, and print the result.