#!/usr/bin/python
# -*- coding: utf-8 -*-
# Python 3 code to find sum
# of elements in given array
def _sum(arr):# initialize a variable
# to store the sum
# while iterating through
# the array latersum = 0
# iterate through the array
# and add each element to the sum variable
# one at a timefor i in arr:
sum = sum + ireturn sum
# driver functionarr = []
# input values to list
arr = [12, 3, 4, 15]
# calculating length of array
n = len(arr)
ans = _sum(arr)
# display sum
print ('Sum of the array is ', ans)