求解答,为什么输出的答案不对?
def square_of_sum(x):
result = 0
for M in x :
y=[]
y.append(M*M)
result=sum(y)
return result
print(square_of_sum([1, 2, 3, 4, 5]))
print(square_of_sum([-5, 0, 5, 15, 25]))
def square_of_sum(x):
result = 0
for M in x :
y=[]
y.append(M*M)
result=sum(y)
return result
print(square_of_sum([1, 2, 3, 4, 5]))
print(square_of_sum([-5, 0, 5, 15, 25]))
2023-04-22
举报