运行成功,请给点优化建议
def square_of_sum(L):
A=[]
n=0
for L[n] in L:
A.append(L[n]*L[n])
n+1
if n>len(L)-1:
break
return sum(A)
print square_of_sum([1, 2, 3, 4, 5])
print square_of_sum([-5, 0, 5, 15, 25])
def square_of_sum(L):
A=[]
n=0
for L[n] in L:
A.append(L[n]*L[n])
n+1
if n>len(L)-1:
break
return sum(A)
print square_of_sum([1, 2, 3, 4, 5])
print square_of_sum([-5, 0, 5, 15, 25])
2020-03-18
举报