课程
/后端开发
/Python
/初识Python
def square_of_sum(list): sum=0 for x in list: sum=sum+x^2 print(sum) return square_of_sum([1,2,3])
2019-01-28
源自:初识Python 7-3
正在回答
python里幂^是用**表示,print和return的缩进也有问题
def square_of_sum(list): sum=0 for x in list: sum=sum+x**2 print (sum) return square_of_sum([1,2,3])
print (sum)
return
修改成return sum
举报
学python入门视频教程,让你快速入门并能编写简单的Python程序