Your question is Power Function Implementation. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Hulu playback services may need to compute scaling factors such as a^b efficiently. Implement power(a, b) without using Python's built-in exponentiation functions, such as pow() or **.
Use binary exponentiation to reduce the number of multiplications. The exponent may be positive, zero, or negative.
a, a nonzero integer or floating-point base, and b, an integer exponent.a^b. Return 1 when b is 0. For a negative exponent, return the reciprocal of the corresponding positive power.def power(a, b):