Sum of integers greater than or equal to 10

This Python code snippet returns the sum of integers that are greater than or equal to 10 in a list.

Problem

Given a list of integers, write a function that returns the sum of the integers that are greater than or equal to 10.
Example input: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
Example output: 75

Solution

This solution is in Python. Our A.I. can create solutions in multiple languages.
by kayakane
def sum_of_integers(list_of_integers):
    sum = 0
    for i in list_of_integers:
        if i >= 10:
            sum += i
    return sum

print(sum_of_integers([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]))

A.I. Evaluation of the Solution

The candidate's solution correctly solves the problem. They iterate through the list, checking if each integer is greater than or equal to 10. If it is, they add it to the sum. This is a solid approach that would work well for this problem.

Evaluated at: 2023-01-27 18:15:51