Skip to content

Commit 1c20f42

Browse files
authored
Implement basic arithmetic functions in calculator.py
1 parent a96829b commit 1c20f42

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

calculator.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
def add(a, b):
2+
return a + b
3+
4+
def subtract(a, b):
5+
return a - b
6+
7+
def multiply(a, b):
8+
return a * b
9+
10+
def divide(a, b):
11+
if b == 0:
12+
raise ValueError("Cannot divide by zero")
13+
return a / b

0 commit comments

Comments
 (0)