Write a function, named hypotenuse, that takes two arguments corresponding to the lengths of the sides adjacent to the right angle of a right-triangle and that returns the hypotenuse of the triangle. You will need to use the math.sqrt function from the math library, so be sure to import math at the top of your source file.
import math def hypotenuse(a,b): return math.sqrt(math.pow(a,2)+math.pow(b,2)) if __name__ == "__main__": print("Hypotenuse Example") a = int(input("Enter Side One:\n")) b = int(input("Enter Side Tw:\n")) print("Hypotenuse is %0.4f"%(hypotenuse(a,b)))
Get Answers For Free
Most questions answered within 1 hours.