Added doctest to /maths/power_using_recursion.py (#11994)

This commit is contained in:
Sankabapur 2024-12-30 16:29:03 +05:30 committed by GitHub
parent 24923ee635
commit da587d06ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -38,6 +38,14 @@ def power(base: int, exponent: int) -> float:
Traceback (most recent call last):
...
RecursionError: maximum recursion depth exceeded
>>> power(0, 0)
1
>>> power(0, 1)
0
>>> power(5,6)
15625
>>> power(23, 12)
21914624432020321
"""
return base * power(base, (exponent - 1)) if exponent else 1