Skip to content

Commit 935febe

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent bde1393 commit 935febe

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

maths/power_using_iteration.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def power(base: float, exponent: int) -> float:
4646
raise ValueError("0.0 raised to the power of 0 is indeterminate.")
4747
if base == 0 and exponent < 0:
4848
raise ZeroDivisionError("0.0 cannot be raised to a negative power.")
49-
49+
5050
result = 1.0
5151
if exponent < 0:
5252
base = 1 / base
@@ -60,7 +60,6 @@ def power(base: float, exponent: int) -> float:
6060

6161

6262
if __name__ == "__main__":
63-
6463
import doctest
6564

6665
doctest.testmod()

maths/power_using_recursion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ def power(base: int, exponent: int) -> float:
6060
result = power(base, abs(exponent))
6161
if exponent < 0: # power() does not properly deal w/ negative exponents
6262
result = 1 / result
63-
print(f"{base} to the power of {exponent} is {result}")
63+
print(f"{base} to the power of {exponent} is {result}")

0 commit comments

Comments
 (0)