请问计算x的N次方函数的代码怎么理解?
def power(x, n):
s = 1
while n > 0:
n = n - 1
s = s * x
return s
最不能理解的地方是s=s*x,谢谢
def power(x, n):
s = 1
while n > 0:
n = n - 1
s = s * x
return s
最不能理解的地方是s=s*x,谢谢
2017-02-26
举报