From 9c3170a252119959e0333daba16e491f7d526812 Mon Sep 17 00:00:00 2001 From: SHAKTI SINGH <69802758+nazgul-beta@users.noreply.github.com> Date: Fri, 3 Jan 2025 18:07:43 +0530 Subject: [PATCH 1/2] Add calculator.py for review --- calculator.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 calculator.py diff --git a/calculator.py b/calculator.py new file mode 100644 index 0000000..a64607a --- /dev/null +++ b/calculator.py @@ -0,0 +1,20 @@ + +class Calculator: + def add(self, a, b): + # No type checking or validation + return a + b + + def subtract(self, a, b): + # Could use better error handling + return a - b + + def multiply(self, a, b): + # Missing docstring and input validation + return a * b + + def divide(self, a, b): + # Basic division without proper error handling + return a / b + +# Global instance - potential improvement area +calculator = Calculator() From 0f8031d0629e75baa560376100cff2cc1bf00e5f Mon Sep 17 00:00:00 2001 From: SHAKTI SINGH <69802758+nazgul-beta@users.noreply.github.com> Date: Fri, 3 Jan 2025 18:07:43 +0530 Subject: [PATCH 2/2] Add utils.py for review --- utils.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 utils.py diff --git a/utils.py b/utils.py new file mode 100644 index 0000000..865a2c1 --- /dev/null +++ b/utils.py @@ -0,0 +1,17 @@ + +def validate_number(num): + # Basic validation without proper type checking + try: + float(num) + return True + except: + return False + +def format_result(result): + # Simple formatting without proper rounding or precision handling + return str(result) + +def parse_input(input_str): + # Basic parsing without proper error handling + parts = input_str.split() + return float(parts[0]), parts[1], float(parts[2])