0 out of 464 challenges solved
Write a Python function `find_hypotenuse(a: float, b: float) -> float` that calculates the hypotenuse of a right-angled triangle given the lengths of the other two sides. Use the Pythagorean theorem to compute the result. The Pythagorean theorem states: \[ c^2 = a^2 + b^2 \] Where: - `c` is the hypotenuse (the side opposite the right angle). - `a` and `b` are the other two sides of the triangle. #### Example Usage ```python [main.nopy] find_hypotenuse(3, 4) # Expected output: 5.0 find_hypotenuse(5, 12) # Expected output: 13.0 find_hypotenuse(8, 15) # Expected output: 17.0 ``` #### Constraints - The inputs `a` and `b` will always be positive floating-point numbers. - The function should return a floating-point number rounded to two decimal places.
import math
def find_hypotenuse(a: float, b: float) -> float:
"""
Calculate the hypotenuse of a right-angled triangle given the other two sides.
Args:
a (float): Length of one side.
b (float): Length of the other side.
Returns:
float: Length of the hypotenuse.
"""
# Implement the Pythagorean theorem here
pass