Skip to content

Commit a55058b

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

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

maths/power_using_iteration.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def power(base: float, exponent: int) -> float:
2424
39.0625
2525
>>> power(-3.5, 2)
2626
12.25
27-
>>> power(-2, 3)
27+
>>> power(-2, 3)
2828
-8.0
2929
>>> power(0, 5)
3030
0.0
@@ -34,9 +34,9 @@ def power(base: float, exponent: int) -> float:
3434
Traceback (most recent call last):
3535
...
3636
ZeroDivisionError: 0.0 cannot be raised to a negative power.
37-
>>> power(1, 1000)
37+
>>> power(1, 1000)
3838
1.0
39-
39+
4040
"""
4141
result = 1.0
4242
if exponent < 0:
@@ -52,6 +52,7 @@ def power(base: float, exponent: int) -> float:
5252

5353
if __name__ == "__main__":
5454
import doctest
55+
5556
doctest.testmod()
5657
print("Raise base to the power of exponent using an optimized approach...")
5758

0 commit comments

Comments
 (0)