Sum of integers in array

To find the sum of integers in an array, simply iterate through the array and add each integer to a total sum.

Problem

Given an array of integers, return the sum of the integers in the array.
Example input:
[1, 2, 3, 4, 5]
Example output:
15

Solution

This solution is in Python. Our A.I. can create solutions in multiple languages.
by kayakane
def sum_of_array(array):
    return sum(array)

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

A.I. Evaluation of the Solution

This solution is complete and solves the problem. The approach is straightforward and easy to understand.

Evaluated at: 2022-11-18 14:16:31