• Even the Last Run and Check error


I would like to give some feedback about ...

From: http://www.checkio.org/mission/even-last/solve/


Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/48.0.2564.116 Chrome/48.0.2564.116 Safari/537.36


I am not entirely sure that my solution is correct, which would explain why I keep receiving errors. However, when I print my result variable to the console, it shows that it holds the correct value both during the summing process, and after the final multiplication. Unfortunately, when I attempt to return the result variable, it no longer contains the same correct value.

def checkio(array): """ sums even-indexes elements and multiply at the last """ if len(array) == 0: return 0

result = 0
for i in range(0, len(array), 2):
    result += i

result = result * array[-1]
return (result)