1
1
Fork 0
PythonLearning/hypotenuse/main.py

17 lines
407 B
Python
Raw Normal View History

2024-05-08 10:41:01 -04:00
from math import sqrt
def calculate_hypotenuse(x: float, y: float) -> float:
2024-05-08 12:14:29 -04:00
x = float(x)
y = float(y)
return sqrt(x**2 + y**2)
2024-05-08 10:41:01 -04:00
if __name__ == "__main__":
2024-05-08 12:14:29 -04:00
x = input("Input your A: ")
y = input("Input your B: ")
try:
result = calculate_hypotenuse(x,y)
print(f"{round(result)} ({result})")
except ValueError:
print("Error! Please do not input strings.")