raise base to the power of exponent using recursion input enter the base 3 enter the exponent 4 output 3 to the power of 4 is 81 input enter the base 2 enter the exponent 0 output 2 to the power of 0 is 1 calculate the power of a base raised to an exponent power3 4 81 power2 0 1 allpowerbase exponent powbase exponent for base in range10 10 for exponent in range10 true power a 1 a power a 2 traceback most recent call last typeerror can t multiply sequence by nonint of type str power a b traceback most recent call last typeerror unsupported operand types for str and int power2 1 traceback most recent call last recursionerror maximum recursion depth exceeded calculate the power of a base raised to an exponent power 3 4 81 power 2 0 1 all power base exponent pow base exponent for base in range 10 10 for exponent in range 10 true power a 1 a power a 2 traceback most recent call last typeerror can t multiply sequence by non int of type str power a b traceback most recent call last typeerror unsupported operand type s for str and int power 2 1 traceback most recent call last recursionerror maximum recursion depth exceeded power does not properly deal w negative exponents
def power(base: int, exponent: int) -> float:
    
    return base * power(base, (exponent - 1)) if exponent else 1


if __name__ == "__main__":
    from doctest import testmod

    testmod()
    print("Raise base to the power of exponent using recursion...")
    base = int(input("Enter the base: ").strip())
    exponent = int(input("Enter the exponent: ").strip())
    result = power(base, abs(exponent))
    if exponent < 0:  
        result = 1 / result
    print(f"{base} to the power of {exponent} is {result}")