a=[]
a.append(3)
a.append(7)
for j in range(2,23480):
a[j]=a[j-2]+(j+2)*(j+3)/2
當我寫這篇文章的代碼,它提供了這樣的錯誤:Python的錯誤
Traceback (most recent call last):
File "C:/Python26/tcount2.py", line 6, in <module>
a[j]=a[j-2]+(j+2)*(j+3)/2
IndexError: list assignment index out of range
能告訴我爲什麼和如何調試呢?
IMO應該是公認的答案。 – bernie 2009-06-08 21:33:10