Discuss / Python / 位置参数没看懂

位置参数没看懂

Topic source

一言叶子

#1 Created at ... [Delete] [Delete and Lock User]

不明白为什么计算x的n次方的函数要这么写  x和n的关系仅从那里也看不出来啊

一只饭人

#2 Created at ... [Delete] [Delete and Lock User]

同问,我也没看懂这里。还有s=1这里的值是什么意思。

风铃草Ella

#3 Created at ... [Delete] [Delete and Lock User]

x的0次方=1,所以如果n为0的话函数值就是1.如果n=1的话,函数值就是x*1=x,以此类推,用while循环实现,乘一次就少一次,直到n不再大于0,计算终止。

六千丶里

#4 Created at ... [Delete] [Delete and Lock User]

我为什么在编辑器上写好了,在cmd里调用的时候,power(5,2)他只出现5,但自己在cmd里写的时候却是好的


  • 1

Reply