I'm a newbie who is trying to go through the quests. While I was doing the puzzles. I've encountered with a problem;
def checkio(array: list) -> int:
total = 0
if len(array) == 0:
for i in array:
if array.index(i)%2 == 0:
total = total + i
a = array[-1]
This the code I've written to solve the puzzle but when I try to finish the quest this list gives an error.
the code runs well until the 16. item =84,
it passes through that one and continues to sum up the items then multiply the result with the last item on the list which gives me an error.
Whats the problem in here,
Created at: 2022/04/22 14:48; Updated at: 2022/05/28 22:57
The question is resolved.