python缩进区别分析

上传:xmjdh 浏览: 21 推荐: 0 文件:PDF 大小:33KB 上传时间:2021-02-01 06:06:39 版权申诉
仔细观察下面两个python程序,代码一模一样,但是运行的结果却不同,就是因为最后一行return缩进的不同复制代码 代码如下:def powersum(power, *args): ”’Return the sum of each argument raised to specified power.”’total = 0for i in args:total += pow(i, power)return total运行时输入powersum(2,3,4)输出25(3的平方加上4的平方)复制代码 代码如下:def powersum(power, *args):”’Return the sum
上传资源
用户评论