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]
Created at: 2021/12/30 21:34; Updated at: 2021/12/30 21:40
The question is resolved.