Write a Python program that uses the math module to find the hypotenuse of a right triangle given the lengths of the other two sides.
Example 1:
Input: 3, 4
Output: 5.0
Example 2:
Input: 5, 12
Output: 13.0
The math module contains a function hypot(x, y) that calculates the hypotenuse of a right triangle given the lengths of the other two sides.
import math
# Define the function
def calculate_hypotenuse(a, b):
return math.hypot(a, b)
# Test the function
print(calculate_hypotenuse(3, 4)) # Output: 5.0
print(calculate_hypotenuse(5, 12)) # Output: 13.0
NOTEOwing to browser caching, any code input into the Trinket IDE might carry over across page refreshes or when transitioning between different questions. To commence with a clean slate, either click on the 'Reset Button' found within the IDE's Hamburger icon (☰) menu or resort to using Chrome's Incognito Mode.