要用到list的append
x=1
n=1
L = [x*x]
while True:
n = n + 1
if n > 100:
break
x = x + 1
L.append(x*x)
print sum(L)
x=1
n=1
L = [x*x]
while True:
n = n + 1
if n > 100:
break
x = x + 1
L.append(x*x)
print sum(L)
2015-07-20
举报