Given an array of integers, find the sum of its elements.

For example, if the array $ar=[1,2,3]$, $1+2+3=6$, so return $6$.  

Function Description

Complete the simpleArraySum function in the editor below.  It must return the sum of the array elements as an integer.  

simpleArraySum has the following parameter(s):  

ar: an array of integers  

Input Format

The first line contains an integer, $n$, denoting the size of the array. 

The second line contains $n$ space-separated integers representing the array's elements.  

Constraints

$0<n,ar[i]\leq1000$    

Output Format

Print the sum of the array's elements as a single integer.  

Sample Input
6
1 2 3 4 10 11

Sample Output
31

Explanation

We print the sum of the array's elements: $1+2+3+4+10+11=31$.

Source: hackerrank | Difficulty: EASY


Solutions:
n = int(input())
nums = list(map(int, input().split()))
sum = 0
for num in nums:
	sum += num
print(sum)


n = input()
l = list(map(int, input().split(' ')))
print(sum(l))


import sys
n = int(input())
data = sys.stdin.readlines()[0].split()
s = 0
for i in range(0, n):
	s += int(data[i])
print(s)


input()
print(sum([int(x) for x in input().split()]))


N = int(input())
array = map(int, input().split())
print(sum(array))


n = int(input())
print(sum(map(int, input().split(' '))))


input('')
print(sum((int(s) for s in input('').split())))


n = input()
l = map(int, input().split())
print(sum(l))


amount = input()
nums = input().split(' ')
sum = 0
for num in nums:
	sum += int(num)
print(sum)


n = int(input())
print(sum((int(i) for i in input().split())))


num = int(input())
c = input().strip().split(' ')
z = [int(x) for x in c]
sum = 0
for x in z:
	sum = sum + x
print(sum)


n = int(input())
l = input().split()
sum = 0
for i in range(n):
	sum += int(l[i])
print(sum)


n = input()
print(sum(list(map(int, input().split()))))


n = int(input())
sum = 0
nums = input().split()
for j in nums:
	sum += int(j)
print(sum)


s = input()
print(sum([int(i) for i in input().split()]))


n = int(input())
sum = 0
a = []
a = input().split()
a = list(map(int, a))
for x in a:
	sum += x
print(sum)


n = int(input())
arr = [int(i) for i in input().split()]
total = 0
for i in range(0, n):
	total += arr[i]
print(total)


n = int(input())
a = list(map(int, input().split()))
print(sum(a))


x = input()
n = input()
n = n.split()
t = 0
for no in n:
	t += int(no)
print(t)


sum = 0
n = int(input())
a = input().split()
for i in range(0, n):
	b = int(a[i])
	sum = sum + b
print(sum)


n = int(input(''))
a = []
x = input().split()
for i in range(len(x)):
	a.append(int(x[i]))
total = 0
for j in range(len(a)):
	total += a[j]
print(total)


n = int(input())
L = sum(list(map(int, input().split())))
print(L)


n = int(input())
l = [int(i) for i in input().split()]
print(sum(l))


int(input())
nums = input().split()
nums = list(map(int, nums))
sum = 0
for num in nums:
	sum += num
print(sum)


sz_arr = int(input())
print(sum(map(int, input().split())))


input()
print(sum([int(x) for x in input().strip().split()]))


n = int(input())
l = list(map(int, input().split()))
sum = 0
for i in l:
	sum = sum + i
print(sum)


input()
a = [int(x) for x in input().split()]
print(sum(a))


l = input()
l = [int(i) for i in input().split(' ')]
print(sum(l))


n = int(input())
arr = input().split()
s = 0
for i in range(0, n):
	s += int(arr[i])
print(s)


n = input()
c = 0
for i in input().split():
	c += int(i)
print(c)


def sumArray(array):
	a = 0
	result = 0
	for x in array:
		result = array[a] + result
		a = a + 1
	return result
N = input()
array = input()
array = array.split()
a = 0
for x in array:
	array[a] = int(array[a])
	a = a + 1
print(sumArray(array))


numInts = int(input())
total = 0
numberArray = input().split()
for i in range(len(numberArray)):
	total = total + int(numberArray[i])
print(total)


length = input()
print(sum([int(n) for n in input().split()]))


n = int(input())
A = [int(a) for a in input().split()]
print(sum(A))


def sum(num, nums):
	ret = 0
	vals = nums.split()
	for x in range(0, num):
		ret += int(vals[x])
	return ret
n = int(input())
list = input()
val = sum(n, list)
print(val)


input()
print(sum([int(x) for x in input().split()]))


input()
print(sum(map(lambda x: int(x), list(input().split()))))


a = input()
b = input().split()
c = 0
for i in b:
	c = c + int(i)
print(c)


b = int(input())
j = []
j = input().split()
x = 0
for i in range(0, b):
	x += int(j[i])
print(x)


n = int(input())
a = input().split()
sum = 0
for i in range(n):
	sum += int(a[i])
print(sum)


input()
total = sum(map(int, input().split()))
print(total)


N = int(input())
print(sum(map(int, input().split(' '))))


Num = int(input())
Num2 = input().split(' ')
lst = list()
for i in Num2:
	i = int(i)
	lst.append(i)
	sums = sum(lst)
print(sums)


N = int(input())
array = [int(x) for x in input().split()]
print(sum(array[:N]))


x = int(input())
y = input().split()
sum = 0
for i in range(0, x):
	sum = sum + int(y[i])
print(sum)


_ = input()
sum = 0
for x in input().split():
	sum += int(x)
print(sum)


n = int(input())
v = input().strip().split()
val = [x for x in v]
res = 0
for i in val:
	res += int(i)
print(res)


t = input()
arr = map(int, input().split())
print(sum(arr))


t = int(input())
i = 0
sum = 0
s = input().split()
while i < t:
	sum = sum + int(s[i])
	i += 1
print(sum)


def sumd():
	n = int(input())
	ar = [int(x) for x in input().split(' ')]
	sum = 0
	for i in range(n):
		sum += ar[i]
	print(sum)
sumd()


a = input()
b = input().split()
print(sum(map(int, b)))


n = input()
print(sum((int(i) for i in input().split())))


input()
print(sum((int(x) for x in input().split(' '))))


N = input()
NL = map(int, input().split(' '))
print(sum(NL))


N = int(input())
A = [int(value) for value in input().split()]
print(sum(A))


n = int(input())
a = [int(x) for x in input().split()]
sum = 0
for i in range(n):
	sum += a[i]
print(sum)


a = int(input())
b = input().split()
b = [int(x) for x in b]
print(sum(b))


size = int(input())
array = input().split()
sum = 0
for i in range(0, size):
	sum += int(array[i])
print(sum)


n = int(input())
A = list(map(int, input().split()))
print(sum(A))


def counting(number, split):
	total = 0
	for i in range(0, number):
		total += int(split[i])
	return total
num = int(input())
array = input().split()
print(counting(num, array))


input()
print(sum([int(x) for x in input().split()]))


_ = input()
nums = input().split()
ans = sum((int(i) for i in nums))
print(ans)


def solveMeSecond(n):
	return su
leng = int(input())
n = input()
su = 0
for i in n.split(' '):
	su = su + int(i)
print(su)


sice = int(input())
xs = list(map(int, input().split()))
sum = 0
for x in xs:
	sum = sum + x
print(sum)


count = int(input())
sum = 0
for i in input().split(' '):
	sum += int(i)
print(sum)


import sys
N = int(sys.stdin.readline())
elts = (int(x) for x in sys.stdin.readline().split())
sum = 0
for i in elts:
	sum += i
print(sum)


input()
print(sum(map(int, input().split(' '))))


n = int(input())
s = input()
temp = s.split(' ')
ans = 0
for i in temp:
	ans += int(i)
print(ans)


n = int(input())
inp = input()
inp = inp.split(' ')
for i in range(n):
	inp[i] = int(inp[i])
print(sum(inp))


input()
print(sum((int(i) for i in input().split())))


input()
print(sum([int(x) for x in input().split()]))


n = int(input())
elements = input().split()
sum = 0
for a in elements:
	sum += int(a)
print(sum)


a = int(input())
b = list(map(int, input().split(' ')))
c = 0
for i in range(a):
	c += b[i]
print(c)


n = input()
a = list(map(int, input().split()))
res = sum(a)
print(res)


T = int(input())
numlist = map(int, input().split())
sum1 = 0
for i in numlist:
	sum1 += i
print(sum1)


input()
print(sum(list(map(int, input().split()))))


input()
print(sum(list(map(int, input().split()))))


n = int(input())
numbers = input().split()
numbers = map(int, numbers)
sum = 0
for i in numbers:
	sum = sum + i
print(sum)


n = int(input())
arr = input().split()
arrSum = 0
for i in range(0, n):
	arrSum += int(arr[i])
print(arrSum)


n = int(input())
data = input().split()
sum = 0
i = 0
for i in range(0, n):
	sum = sum + int(data[i])
print(sum)


def main():
	size = int(input())
	array = input().split()
	sum = 0
	for item in array:
		sum += int(item)
	print(sum)
main()


n = int(input())
a = list(map(int, input().split()))
print(sum(a))


a = int(input())
b = []
b = input().split(' ')
sum = 0
for i in b:
	sum = sum + int(i)
print(sum)


input()
Ns = input()
Ns = Ns.split()
Ns = map(int, Ns)
print(sum(Ns))


n = int(input())
a = input().split(' ')
z = 0
for i in range(0, n):
	z += int(a[i])
print(z)


total = int(input())
x = 0
nums = input().split()
for num in nums:
	x += int(num)
print(x)


number = int(input())
output = 0
for element in input().split():
	output += int(element)
print(output)


n = int(input())
numbers = input().split()
assert len(numbers) == n
print(sum(map(int, numbers)))


n = int(input())
A = [int(x) for x in input().split()]
print(sum(A))


N = input()
A = input()
tot = 0
for i in A.split():
	tot = tot + int(i)
print(tot)


def fuction(A, n):
	value = 0
	z = 0
	for i in range(n):
		value = value + A[z]
		z = z + 1
	return value
n = int(input())
A = input().split()
z = 0
for i in range(n):
	A[z] = int(A[z])
	z = z + 1
print(fuction(A, n))


n = int(input())
sum = 0
a = input().split()
for i in a:
	sum += int(i)
print(sum)


n = int(input())
print(sum([int(x) for x in input().split(' ')]))


n = input()
line = input()
sum = 0
for n in line.split():
	sum += int(n)
print(sum)


N = int(input())
a = input().split()
b = [int(x) for x in a]
sum = 0
for i in range(N):
	sum = sum + b[i]
print(sum)


input()
a = map(int, input().split())
print(sum(a))


count = int(input())
print(sum([int(n) for n in input().split()]))