def checkio(array: list) -> int:
"""
Sums even-indexes elements and multiply at the last
"""
a = []
if array:
for i in array:
if array.index(i) == 0 or array.index(i) % 2 == 0:
a.append(i)
print(a)
return sum(a) * array[-1]
else:
return 0
checkio([-37, -36, -19, -99, 29, 20, 3, -7, -64, 84, 36, 62, 26, -76, 55, -24, 84, 49, -65, 41])
The output for print(a)
is [-37, -19, 29, 3, -64, 36, 26, 55, -65]
, but 84 is not included in the list. Why is it doing so?