Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
to use islice solution in Uncategorized category for Even the Last by Orthomonalus
from itertools import islice
def checkio(array):
return sum(islice(array, None, None, 2)) * array[-1] if array else 0
print("Example:")
print(checkio([0, 1, 2, 3, 4, 5]))
# These "asserts" are used for self-checking
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!")
Oct. 27, 2025
Comments: