Skip to content

Commit 9bd7560

Browse files
Replace non-descriptive parameter names with descriptive ones
Changed parameter names from 'a' and 'b' to 'numerator' and 'denominator' throughout the function to satisfy the 'require descriptive names' requirement from algorithms-keeper bot. Updated function signature, docstring, and all usages within the function body.
1 parent 4607b86 commit 9bd7560

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

maths/division.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@
66
"""
77

88

9-
def divide_numbers(a: float, b: float) -> float:
9+
def divide_numbers(numerator: float, denominator: float) -> float:
1010
"""
1111
Divide two numbers with input validation for zero denominator.
1212
1313
Args:
14-
a: The numerator (dividend)
15-
b: The denominator (divisor)
14+
numerator: The numerator (dividend)
15+
denominator: The denominator (divisor)
1616
1717
Returns:
18-
float: The result of a divided by b
18+
float: The result of numerator divided by denominator
1919
2020
Raises:
21-
ValueError: If b is zero
21+
ValueError: If denominator is zero
2222
2323
Examples:
2424
>>> divide_numbers(10, 2)
@@ -30,11 +30,11 @@ def divide_numbers(a: float, b: float) -> float:
3030
...
3131
ValueError: Cannot divide by zero. Please provide a non-zero denominator.
3232
"""
33-
if b == 0:
33+
if denominator == 0:
3434
raise ValueError(
3535
"Cannot divide by zero. Please provide a non-zero denominator."
3636
)
37-
return a / b
37+
return numerator / denominator
3838

3939

4040
if __name__ == "__main__":

0 commit comments

Comments
 (0)