SeaswimmerTheFsh
68569900e0
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 11s
21 lines
628 B
Python
21 lines
628 B
Python
from math import sqrt
|
|
|
|
# ANSI color codes
|
|
BLUE = "\033[34m" # Blue
|
|
RED = "\033[31m" # Red
|
|
GREEN = "\033[32m" # Green
|
|
RESET = "\033[0m" # Reset to default color
|
|
|
|
def calculate_hypotenuse(x: float, y: float) -> float:
|
|
x = float(x)
|
|
y = float(y)
|
|
return sqrt(x**2 + y**2)
|
|
|
|
if __name__ == "__main__":
|
|
x: str = input(f"{BLUE}Input your A:{RESET} ")
|
|
y: str = input(f"{BLUE}Input your B:{RESET} ")
|
|
try:
|
|
result: float = calculate_hypotenuse(float(x), float(y))
|
|
print(f"{GREEN}{round(result)} ({result}){RESET}")
|
|
except ValueError:
|
|
print(f"{RED}Please do not input strings.{RESET}")
|