Skip to content

Commit 53ca0d3

Browse files
committed
Merge branch 'optimized-power-iteration' of https://github.com/SajeevSenthil/Python into optimized-power-iteration
2 parents 1b86189 + a55058b commit 53ca0d3

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
@@ -38,9 +38,9 @@ def power(base: float, exponent: int) -> float:
3838
Traceback (most recent call last):
3939
...
4040
ValueError: 0.0 raised to the power of 0 is indeterminate.
41-
>>> power(1, 1000)
41+
>>> power(1, 1000)
4242
1.0
43-
43+
4444
"""
4545
if base == 0 and exponent == 0:
4646
raise ValueError("0.0 raised to the power of 0 is indeterminate.")
@@ -62,6 +62,7 @@ def power(base: float, exponent: int) -> float:
6262
if __name__ == "__main__":
6363

6464
import doctest
65+
6566
doctest.testmod()
6667
print("Raise base to the power of exponent using an optimized approach...")
6768

0 commit comments

Comments
 (0)