From 78f76db0764537957764b2cf19d3baad114225ba Mon Sep 17 00:00:00 2001 From: Vyshnav S Deepak Date: Fri, 25 Apr 2025 10:19:24 +0530 Subject: [PATCH 1/2] feat: add subtraction --- calculator.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/calculator.py b/calculator.py index 607c2c2..2b27e69 100644 --- a/calculator.py +++ b/calculator.py @@ -2,8 +2,12 @@ class Calculator: def add(self, x, y): return x + y + def subtract(self, x, y): + return x - y + if __name__ == "__main__": calc = Calculator() print("Welcome to Calculator!") - print("Current feature: Addition") - print("Example: 5 + 3 =", calc.add(5, 3)) \ No newline at end of file + print("Current features: Addition, Subtraction") + print("Example: 5 + 3 =", calc.add(5, 3)) + print("Example: 5 - 3 =", calc.subtract(5, 3)) \ No newline at end of file From 63c1253947c5d39ad6a6118815abcb04114d43b6 Mon Sep 17 00:00:00 2001 From: Vyshnav S Deepak Date: Fri, 25 Apr 2025 10:19:34 +0530 Subject: [PATCH 2/2] feat: add multiplication --- calculator.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/calculator.py b/calculator.py index 2b27e69..bb224b7 100644 --- a/calculator.py +++ b/calculator.py @@ -1,13 +1,17 @@ -class Calculator: - def add(self, x, y): - return x + y +class Calculator: + def add(self, x, y): + return x + y + + def subtract(self, x, y): + return x - y - def subtract(self, x, y): - return x - y - -if __name__ == "__main__": - calc = Calculator() - print("Welcome to Calculator!") - print("Current features: Addition, Subtraction") - print("Example: 5 + 3 =", calc.add(5, 3)) - print("Example: 5 - 3 =", calc.subtract(5, 3)) \ No newline at end of file + def multiply(self, x, y): + return x * y + +if __name__ == "__main__": + calc = Calculator() + print("Welcome to Calculator!") + print("Current features: Addition, Subtraction, Multiplication") + print("Example: 5 + 3 =", calc.add(5, 3)) + print("Example: 5 - 3 =", calc.subtract(5, 3)) + print("Example: 5 * 3 =", calc.multiply(5, 3)) \ No newline at end of file