Skip to content

Commit a0ce042

Browse files
committed
1 parent ced9139 commit a0ce042

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

05-methods/calculator.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
"""A simple calculator that can perform addition and subtraction.
2+
"""
3+
14

25
def calculate(x: int, y: int = 1, *, subtract: bool = False) -> int:
3-
"""Calculates the sum (or difference) of two numbers.
6+
"""Calculate sum (or difference) of two numbers.
47
58
Parameters:
69
`x` : int, required
@@ -9,6 +12,10 @@ def calculate(x: int, y: int = 1, *, subtract: bool = False) -> int:
912
The second number (default is 1)
1013
`subtraction`: bool, optional
1114
Whether to perform subtraction. Default is False.
15+
16+
Returns:
17+
int
18+
The result of the operation on `x` and `y`
1219
"""
1320

1421
return x - y if subtract else x + y

0 commit comments

Comments
 (0)