Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
"Even the Last" solution in Uncategorized category for Even the Last by Mateusz_Wryszcz
def checkio(array: list[int]) -> int:
if not array:
return 0
even_sum = sum(array[i] for i in range(0, len(array), 2))
result = even_sum * array[-1]
return result
print("Example:")
print(checkio([0, 1, 2, 3, 4, 5]))
assert checkio([0, 1, 2, 3, 4, 5]) == 30
assert checkio([1, 3, 5]) == 30
assert checkio([6]) == 36
assert checkio([]) == 0
print("The mission is done! Click 'Check Solution' to earn rewards!")
Dec. 21, 2022