from math import sqrt
def main():
print("Calculator for sqrt(x/y)")
x = float(input("Enter x: "))
y = float(input("Enter y: "))
print("Computing sqrt(", x, "/", y, ")")
try:
result = sqrt(x/y)
# Only executed if that didn't raise an exception.
print("The answer is", result)
except ValueError:
print("sqrt does not handle negative numbers!")
except ZeroDivisionError:
print("I cannot divide by zero!")
# Can't use result here! If there was an exception,
# result is uninitialized!
print("Finished computing.")
main()