【发布时间】:2016-06-29 06:11:47
【问题描述】:
a = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
l= []
for i in a:
if a[i] % 2 == 0 :
l.append(a[i])
上面的代码一直抛出错误 - "IndexError: list index out of range"
我不明白该怎么办?
【问题讨论】:
标签: python list error-handling append indexoutofboundsexception