More

# Python Program to Find Hypotenuse

The hypotenuse is the longest side of a right triangle. It is also the side that is not opposite the right angle.

If you’re trying to find the hypotenuse of a right-angled triangle, you can use the following equation:

`h = (a^2 + b^2)`

Where h is the hypotenuse, a and b are the lengths of the other two sides, and x is the angle at which the triangle is drawn.

## Program Code

``````from math import sqrt

a = float(input('Enter the length of the shorter triangle side: '))
b = float(input('Enter the length of the other shorter triangle side: '))

c = sqrt(a**2 + b**2)

print('The length of the hypotenuse is', c)``````

Input Given:

```Enter the length of the shorter triangle side: 3
Enter the length of the other shorter triangle side: 4```

Expected Output:

`The length of the hypotenuse is 5.0`

## Code Explanation

1. We import the sqrt function from the math module.
2. We ask the user to enter the length of the shorter triangle side.
3. We ask the user to enter the length of the other shorter triangle side.
4. We calculate the length of the hypotenuse using the Pythagorean theorem.
5. We print the length of the hypotenuse.
Disclaimer: While we make every effort to update the information, products, and services on our website and related platforms/websites, inadvertent inaccuracies, typographical errors, or delays in updating the information may occur. The material provided on this site and associated web pages is for reference and general information purposes only. In case of any inconsistencies between the information provided on this site and the respective product/service document, the details mentioned in the product/service document shall prevail. Subscribers and users are advised to seek professional advice before acting on the information contained herein. It is recommended that users make an informed decision regarding any product or service after reviewing the relevant product/service document and applicable terms and conditions. If any inconsistencies are observed, please reach out to us.