Simple Array Sum

  • + 0 comments

    To solve this problem, we need to calculate the sum of the elements in the given array. Here's how you can implement the function simpleArraySum in Python:

    def simpleArraySum(ar):
        # Return the sum of the array elements
        return sum(ar)
    
    # Read input
    n = int(input())  # This reads the size of the array (though it's not necessary to use it directly)
    ar = list(map(int, input().split()))  # This reads the array elements
    
    # Print the result
    print(simpleArraySum(ar))