From a7581a0bf66cf6fede69972e09b25523684ec3b0 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Wed, 8 May 2024 10:41:01 -0400 Subject: [PATCH 1/2] hypotenuse --- hypotenuse/__init__.py | 0 hypotenuse/main.py | 16 ++++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 hypotenuse/__init__.py create mode 100644 hypotenuse/main.py diff --git a/hypotenuse/__init__.py b/hypotenuse/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/hypotenuse/main.py b/hypotenuse/main.py new file mode 100644 index 0000000..1cb600d --- /dev/null +++ b/hypotenuse/main.py @@ -0,0 +1,16 @@ +from math import sqrt + + +def calculate_hypotenuse(x: float, y: float) -> float: + x = float(x) + y = float(y) + return sqrt(x**2 + y**2) + +if __name__ == "__main__": + 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.") From c55a25d874065c58e9a00d3c525f7f83a8ce12a7 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Wed, 8 May 2024 12:14:29 -0400 Subject: [PATCH 2/2] pylint fix --- hypotenuse/main.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/hypotenuse/main.py b/hypotenuse/main.py index 1cb600d..664d776 100644 --- a/hypotenuse/main.py +++ b/hypotenuse/main.py @@ -2,15 +2,15 @@ from math import sqrt def calculate_hypotenuse(x: float, y: float) -> float: - x = float(x) - y = float(y) - return sqrt(x**2 + y**2) + x = float(x) + y = float(y) + return sqrt(x**2 + y**2) if __name__ == "__main__": - 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.") + 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.")