我这样为啥不行
def square_of_sum(L): p = [] for n in L: p.append(n ** 2) return sum(p) # for s in p: # sum = sum + s # return sum print square_of_sum([1, 2, 3, 4, 5])
def square_of_sum(L): p = [] for n in L: p.append(n ** 2) return sum(p) # for s in p: # sum = sum + s # return sum print square_of_sum([1, 2, 3, 4, 5])
2017-06-27
举报