• Code stops working if the list is empty

Question related to mission Even the Last

 

Hello,

The below code works correctly if I have a list that is not empty but I can't figure out how to make it work for an empty list.

def checkio(array: list) -> int: num = [] for count, i in enumerate(array): if count % 2 == 0: num.append(i) return sum(num) * array[len(array) - 1]