我通过一段时间的条件运行我的定义,此时我只是希望它将列表中的所有数字打印出来,直到它达到列表的长度。IndexError:列表索引超出范围(打印整数)
然而,当我盖了,我得到了错误
"IndexError: list index out of rage"
我缺少什么?
numList = [5, 2, 21, 8, 20, 36, 1, 11, 13, 4, 17]
def findHighest(intList):
iIndex = 0
iValue = intList[iIndex]
while iIndex != len(intList):
print(iValue)
iIndex = iIndex + 1
iValue = intList[iIndex]
print(findHighest(numList))
我得到打印的名单,但随后编译器错误
你只应该在'intList' – thefourtheye