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). 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..."