sum函数的参数要求是什么?
def square_of_sum(L): for i in L: return sum([i * i]) print square_of_sum([1, 2, 3, 4, 5]) print square_of_sum([-5, 0, 5, 15, 25]) 结果输出是1和55,为什么?
def square_of_sum(L): for i in L: return sum([i * i]) print square_of_sum([1, 2, 3, 4, 5]) print square_of_sum([-5, 0, 5, 15, 25]) 结果输出是1和55,为什么?
2017-02-22
举报