From fde3074c46b3d9f68c4347508470cda46b3122e6 Mon Sep 17 00:00:00 2001 From: Varun Vaibhav Jha <60656060+varunvjha@users.noreply.github.com> Date: Wed, 16 Sep 2020 09:51:40 +0530 Subject: [PATCH 1/2] Update calc.py --- calc.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/calc.py b/calc.py index de80b21..4dca492 100755 --- a/calc.py +++ b/calc.py @@ -37,6 +37,9 @@ def mult(a, b): def div(a, b): return a / b +def power(a, b): + return a**b + # -------------------------------------------------------- # @@ -71,6 +74,8 @@ def div(a, b): print "Product: ", mult(a, b) elif (op == "/"): print "Quotient: ", div(a, b) + elif (op == "^" || op == "**"): + print "Power: ", power(a, b) else: print "Invalid operation..." From 28ffdd1e52747246a5ff3dad96ba879d0093aebe Mon Sep 17 00:00:00 2001 From: Varun Vaibhav Jha <60656060+varunvjha@users.noreply.github.com> Date: Wed, 16 Sep 2020 09:52:42 +0530 Subject: [PATCH 2/2] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a4d3ab2..d443a4f 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ A python calculator project to be cloned by CS 193 students | - | subtraction | | * | multiplication | | / | division | +| ^ | power | ## License See [License](https://github.com/Purdue-CSUSB/pycalc/blob/master/LICENSE).