我通過一段時間的條件運行我的定義,此時我只是希望它將列表中的所有數字打印出來,直到它達到列表的長度。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