Question: Write a program that finds the hypotenuse of a triangle. The program must do the following: Prompt the user for the lengths of leg 1
Write a program that finds the hypotenuse of a triangle. The program must do the following:
Prompt the user for the lengths of leg 1 and leg 2
Use a single if-statement to verify that the two leg entries are numbers (hint: use isnumeric() in Python). If not, the program should end.
If the numbers are numeric, next confirm that they are positive. If not, the program should end.
Calculate the hypotenuse using the math library's sqrt function.
The program's output must be a clear English sentence, with all numbers rounded to two decimal places: "If the legs of a right triangle are 3.00 and 4.00, the hypotenuse is 5.00."
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
