Question DSA-REC-0011
MediumWhat is the output of this code?
def power(x, n):
if n == 0:
return 1
half = power(x, n // 2)
return half * half if n % 2 == 0 else half * half * x
print(power(2, 10))
- A.
100
- B.
1024
- C.
Sign up free to see the answer and a step-by-step explanation.