Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 99f8bbf

Browse files
authoredDec 31, 2024··
Apply suggestions from code review
1 parent 22a3750 commit 99f8bbf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎maths/geometric_mean.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ def compute_geometric_mean(*args: int) -> float:
2929
"""
3030
product = 1
3131
for number in args:
32-
if (not isinstance(number, int)) and (not isinstance(number, float)):
32+
if not isinstance(number, int) and not isinstance(number, float):
3333
raise TypeError("Not a Number")
3434
product *= number
3535
# Cannot calculate the even root for negative product.
3636
# Frequently they are restricted to being positive.
3737
if product < 0 and len(args) % 2 == 0:
3838
raise ArithmeticError("Cannot Compute Geometric Mean for these numbers.")
39-
mean = abs(product) ** (1.0 / len(args))
39+
mean = abs(product) ** (1 / len(args))
4040
# Since python calculates complex roots for negative products with odd roots.
4141
if product < 0:
4242
mean = -mean

0 commit comments

Comments
 (0)
Please sign in to comment.