为什么不用给变量x赋初始值
def square_of_sum(L): sum=0; for x in L: sum += x**2 return sum print square_of_sum([1, 2, 3, 4, 5]) print square_of_sum([-5, 0, 5, 15, 25])
为啥不用给变量x赋初始值
def square_of_sum(L): sum=0; for x in L: sum += x**2 return sum print square_of_sum([1, 2, 3, 4, 5]) print square_of_sum([-5, 0, 5, 15, 25])
为啥不用给变量x赋初始值
2016-04-12
举报