• I dont know why -1700...

Question related to mission Even the Last

 

Hello, below my code:

def checkio(array: list) -> int:

    def last_index():
        array.reverse()
        return array[0]

    def get_or_default(arr, index, default):
        return arr[index] if arr[index:] else default

    if len(array) <= 0:
        return 0

    elif len(array) == 1:
        return array[0] * last_index()

    elif len(array) > 1:
        addition = get_or_default(array, 0, 0) + get_or_default(array, 2, 0) + get_or_default(array, 4, 0)
        return addition * last_index()


if __name__ == '__main__':

    assert checkio([0, 1, 2, 3, 4, 5]) == 30, "(0+2+4)*5=30"
    assert checkio([1, 3, 5]) == 30, "(1+5)*5=30"
    assert checkio([6]) == 36, "(6)*6=36"
    assert checkio([]) == 0, "An empty array = 0"
    assert checkio([-89, -86, 13, -69, 94, -75, 66, 97, -50]) == -900, "((-89) + 13 + 94) * -50 = 900"

I dont know why test want -1700. In this task I shoud sum first, third and fifth index and multi with last index. What I did wrong?

3