• what is the problem?

Question related to mission Even the Last

 
def checkio(array: list) -> int:
    n= len(array)
    if n== 1:
        res= array[0]**2
    elif n == 0:
        res = 0
    else:
        if n%2 ==0:
            c=0
            for i in array:
                c+= i+(i+2)
                res= c*array[-1]
        else:
             k= 0
             for i in range(n):
                k+= i+(i+2)
                res= k*array[-1]


    return res