You are viewing a single comment's thread. Return to all comments →
Here is my code:
`def simple_array_sum(arr): """ Calculates the sum of elements in an array.
Parameters: arr (list): The input array of numbers. Returns: int: The sum of elements in the array. """ return sum(arr)
array = [1, 2, 3, 4, 5] sum_of_array = simple_array_sum(array) print("Sum of the array:", sum_of_array)
`
Seems like cookies are disabled on this browser, please enable them to open this website
Simple Array Sum
You are viewing a single comment's thread. Return to all comments →
Here is my code:
`def simple_array_sum(arr): """ Calculates the sum of elements in an array.
array = [1, 2, 3, 4, 5] sum_of_array = simple_array_sum(array) print("Sum of the array:", sum_of_array)
`