Skip to content

Commit da587d0

Browse files
Added doctest to /maths/power_using_recursion.py (#11994)
1 parent 24923ee commit da587d0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Diff for: maths/power_using_recursion.py

+8
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ def power(base: int, exponent: int) -> float:
3838
Traceback (most recent call last):
3939
...
4040
RecursionError: maximum recursion depth exceeded
41+
>>> power(0, 0)
42+
1
43+
>>> power(0, 1)
44+
0
45+
>>> power(5,6)
46+
15625
47+
>>> power(23, 12)
48+
21914624432020321
4149
"""
4250
return base * power(base, (exponent - 1)) if exponent else 1
4351

0 commit comments

Comments
 (0)