• IndexError: list index out of range, problem

Question related to mission Even the Last

 

I am sure this is something very simple but i just don't see it. Whenever i hit Run&Check i get this error ("IndexError: list index out of range, checkio,") if i delete the "result=result*lastPos" the index error disapears. Can Anyone shed some light on this? Thank you.

result=0
i=0
print (len(array))
while i < len(array):
    result+=array[i]
    i+=2


lastPos = array[-1]
result= result*lastPos
return result