This commit is contained in:
parent
a7581a0bf6
commit
c55a25d874
1 changed files with 10 additions and 10 deletions
|
@ -2,15 +2,15 @@ from math import sqrt
|
||||||
|
|
||||||
|
|
||||||
def calculate_hypotenuse(x: float, y: float) -> float:
|
def calculate_hypotenuse(x: float, y: float) -> float:
|
||||||
x = float(x)
|
x = float(x)
|
||||||
y = float(y)
|
y = float(y)
|
||||||
return sqrt(x**2 + y**2)
|
return sqrt(x**2 + y**2)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
x = input("Input your A: ")
|
x = input("Input your A: ")
|
||||||
y = input("Input your B: ")
|
y = input("Input your B: ")
|
||||||
try:
|
try:
|
||||||
result = calculate_hypotenuse(x,y)
|
result = calculate_hypotenuse(x,y)
|
||||||
print(f"{round(result)} ({result})")
|
print(f"{round(result)} ({result})")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print("Error! Please do not input strings.")
|
print("Error! Please do not input strings.")
|
||||||
|
|
Loading…
Reference in a new issue