为什么代码里多了一个空格就出现错误了呢?sum = 0 前面少个空格就是OK的,一定要这么严格么?
def square_of_sum(L):
sum = 0
for x in L:
sum = sum + x * x
return sum
print square_of_sum([1, 2, 3, 4, 5])
print square_of_sum([-5, 0, 5, 15, 25])
def square_of_sum(L):
sum = 0
for x in L:
sum = sum + x * x
return sum
print square_of_sum([1, 2, 3, 4, 5])
print square_of_sum([-5, 0, 5, 15, 25])
2015-10-23
举报