Sum of even numbers in a list

This Python function calculates the sum of the even numbers in a given list.

Problem

Given a list of integers, write a Python function to find the sum of the even numbers in the list.
Example input: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Example output: 30

Solution

This solution is in Python. Our A.I. can create solutions in multiple languages.
by kayakane
def sum_even(list):
    sum = 0
    for i in list:
        if i % 2 == 0:
            sum += i
    return sum

print(sum_even([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]))

A.I. Evaluation of the Solution

This solution correctly finds the sum of all even numbers in the given list. The approach is straightforward and easy to follow. Well done!

Evaluated at: 2022-11-18 00:16:24