Question: Write a program in Python, such that user will enter the length of the two sides of a right- angled triangle then calculate the length

Write a program in Python, such that user will enter the length of the two sides of a right- angled triangle then calculate the length of the hypotenuse the longest side of the triangle. You should use functional decomposition hence you should have a function called find_hypot that will accept the two sides being inputted and then calculate and return the hypotenuse. This find_hypot function should ONLY be called if both values for the sides of the right-angled triangle are valid. That is, if any of the sides are 0 or less than 0 then display an error message saying that both sides of triangle must both be greater than 0. You should also have another function called printInfo() that will accept three values, the two sides value entered by user and the hypotenuse . This function will print each of the said values. Add descriptive text to make output displayed more meaningful. In addition, this function printInfo() should be called after calling the find_hypot function. That is, both functions are called only if the sides entered are valid.

PLEASE SHOW SOURCE CODE AT THE END PLEASE

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!