Files

17 lines
366 B
Python

# HumanEval/85
# Loki Mode Multi-Agent Solution
# Attempts: 1
# Passed: True
def add(lst):
"""Given a non-empty list of integers lst. add the even elements that are at odd indices..
Examples:
add([4, 2, 6, 7]) ==> 2
"""
total = 0
for i in range(1, len(lst), 2):
if lst[i] % 2 == 0:
total += lst[i]
return total