Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
5 changes: 5 additions & 0 deletions calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ def mult(a, b):
def div(a, b):
return a / b

def power(a, b):
return a**b


# -------------------------------------------------------- #

Expand Down Expand Up @@ -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..."

Expand Down