Sum of integers in even-numbered positions in list

Given a list of integers, this function returns the sum of the integers in even-numbered positions in the list. For example, given the list [1, 2, 3, 4, 5], the function would return 6 (2 + 4).

Problem

Given a list of integers, return the sum of the integers that are in even-numbered positions in the list.
Input: [1, 2, 3, 4, 5]
Output: 6

Solution

This solution is in Python. Our A.I. can create solutions in multiple languages.
by kayakane
def sum_even_positions(list):
    sum = 0
    for i in range(0, len(list), 2):
        sum += list[i]
    return sum

print(sum_even_positions([1, 2, 3, 4, 5]))

A.I. Evaluation of the Solution

The candidate's solution correctly solves the problem and demonstrates a level of completeness. The approach is straightforward and easy to follow.

Evaluated at: 2022-11-21 00:15:57