Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

beginner python 1. Write a function area_of_triangle_firstname that takes in the input of three sides of a triangle a,b and c as arguments into the

beginner python
image text in transcribed
1. Write a function area_of_triangle_firstname that takes in the input of three sides of a triangle a,b and c as arguments into the function. 2. From triangle area firstname call the two functions given below which also takes a,b and c as function parameters. 3. Write a function is_valid_firstname that takes a,b and c as function parameters to test if the input is valid. This function returns true if sum of every two sides is greater than the third side. If input is not valid, returns false. 4. If the is_valid_firstname function returns a false ask the player to input the sides again and again until the input is valid using a while loop. 5. Only if the the input is valid call the function area_compute firstname that takes the valid a,b and c as function parameters which calculates the area of the triangle using semi perimeter (s) as shown in the formula given below and returns the area calculated. Display the area from the triangle_area_firstname using a meaningful print function. Area needs to be rounded to one decimals using f " or the round function. s=2a+b+cAreass(sa)(sb)(sc) 6. Math module should be used to find the square root. So when area_of_triangle_firstname (3,4,5) is called from the console. Program should print. "Area of triangle with sides 3,4 and 5 is 6.0 square inches.". If area_of triangle_firstname (3,4,9) is called. Program prints. "Invalid input: Sum of any two sides has to be greater than the third side" and ask the player to input again until valid sides are entered and area calculated. Ask for input of three sides of the triangle in one statement using the eval function and Call the area_of_triangle_firstname also from main() after the cdr firstname is called

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions