# File: hypotnoex.py # compute the hypotenuse of a right triangle # # ** this does no error checking ** # # Matt Bishop, MHI 289I, Fall 2022 # # bring in the square root function import sys # # read in the length of the two sides, as floats # note we handle non-numbers as an exception here! # try: x = float(input("First side: ")) except: print("Bye!") sys.exit(0) if x < 0: print("No negative numbers -- be positive!") sys.exit(0) y = float(input("Second side: ")) # looking good . . . do the computation and print the results z = (x + y) ** 0.5 print("A right triange with sides", x, "and", y, "has a hypotenuse of length", z)