使用参考答案会报错是怎么回事呢?
>>>L = []
>>> x = 1
>>> while x <= 100:
L.append(x*x)
x = x+1
>>> print(sum(L))
Traceback (most recent call last):
File "<pyshell#207>", line 1, in <module>
print(sum(L))
TypeError: 'int' object is not callable
>>>
>>>L = []
>>> x = 1
>>> while x <= 100:
L.append(x*x)
x = x+1
>>> print(sum(L))
Traceback (most recent call last):
File "<pyshell#207>", line 1, in <module>
print(sum(L))
TypeError: 'int' object is not callable
>>>
2021-08-03
举报