Skip to content

Commit 4ff3eba

Browse files
authored
Update calculator.py
1 parent 60d571f commit 4ff3eba

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

calculator.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
1-
21
"""
32
An extremely buggy Python math library . . .
43
"""
54

6-
# Should this function even be here?
7-
85
def addition(x: int, y: int) -> int:
96
"""
107
Adds two numbers.
118
12-
Note: `+` is the addition operator in Python.
13-
149
Args:
1510
x (int): The first parameter.
1611
y (int): The second parameter.
@@ -24,30 +19,29 @@ def multiplication(x: int, y: int) -> int:
2419
"""
2520
Multiplies two numbers.
2621
27-
Note: `*` is the multiplication operator in Python.
28-
2922
Args:
3023
x (int): The first parameter.
3124
y (int): The second parameter.
3225
3326
Returns:
34-
int: The multiple of `x` and `y`.
27+
int: The product of `x` and `y`.
3528
"""
3629
return x * y
3730

3831
def division(x: int, y: int) -> int:
3932
"""
40-
Multiplies two numbers.
41-
42-
Note: `//` is the *integer* division operator in Python.
33+
Divides two numbers using integer division.
4334
4435
Args:
4536
x (int): The first parameter.
4637
y (int): The second parameter.
4738
4839
Returns:
49-
int: `x` divided by `y`.
40+
int: `x` divided by `y` (integer division).
41+
42+
Raises:
43+
ValueError: If `y` is zero.
5044
"""
5145
if y == 0:
52-
raise ValueError("You can not divide by 0"
46+
raise ValueError("Cannot divide by zero")
5347
return x // y

0 commit comments

Comments
 (0)