为什么使用循环不行
def square_of_sum(L):
x=0
sum=0
while x<len(L):
sum=sum+L[x]*L[x]
X=X+1
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):
x=0
sum=0
while x<len(L):
sum=sum+L[x]*L[x]
X=X+1
return sum
print square_of_sum([1, 2, 3, 4, 5])
print square_of_sum([-5, 0, 5, 15, 25])
2016-03-15
举报