power(x,n)函数是计算x的n次幂的函数,power(x,n)函数运用了分治算法的思想,调用power(3,3)函数的计算结果是:27
def power(x,n): if n == 2: return x if n%2 == 0: return power(x,n//2) * power(x,n//2) else: return power(x,(n+1)//2) * power(x,(n-1)//2)