• What's wrong?(Even the last)

Question related to mission Even the Last

 

My code works fine when I run it in the Python IDLE, but does not work on the site

def checkio(array):
    total = 0
    if len(array) != 0:
        for i in range(len(array)):
            if i % 2 == 0:
                total += i
        total *= array[-1]
        return total
    else:
        return 0

so what's the problem?