Simple Array Sum

  • + 0 comments

    For Python3 Platform

    with python, you can use the sum function. But with other languages, you have to use the loop to calculate the sum

    def simpleArraySum(ar):
        return sum(ar)
    
    n = int(input())
    ar = list(map(int, input().split()))
    
    result = simpleArraySum(ar)
    
    print(result)