def power(x, y, *others):
if others:
print('Received redundant parameters:', others)
return pow(x, y)
>>> params = (5,) * 2
>>> power(*params)
3125
想问一下3125怎么来的??
params = (5,)*2,也就是(5,5)
因此将power(*params)传进去,也就把x的位置传进去个5,y的位置传进去个5
最后返回的结果是5的5次方,3125了
受教了吗,谢谢