Challenge: Find the Area of a Triangle
This challenge requires you to implement a root function.
We'll cover the following
Problem Statement
- The task is to call the root function
my_area
that calculates the area of a triangle.
=
- A method
triangle_area()
is defined within the moduleshapes
. - The task is to complete the method
- Implement root function.
- Call the root function
my_area
from within the public functiontriangle_area()
. - Print the return value from the root function, i.e., area of the triangle
Input
x and y
Note: Assume that base and height are passed to the function
my_public_function
Output
The area of a triangle
float value
Sample Input
x = 3, y = 4
Sample Output
6
Coding Exercise
Write your code below. It is recommended that you try solving the exercise yourself before viewing the solution.
Note: There is a
my_public_function
function in modulemy_module
given in the code for testing purposes. Do not modify it.
Good luck!🤞
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy