Computer Science, asked by negajod963, 3 months ago

find sum of array in python​

Answers

Answered by jai696
8

\large\mathsf\color{pink}{Solution\: using\: python\: 3}

def calc_sum(arr):

_sum = 0

for n in arr:

_sum += n

return _sum

nums = [int(n) for n in input("enter nums: ").split()]

print(f"sum: {calc_sum(nums)}")

\large\mathsf\color{lightgreen}useful?\: \color{white}\longrightarrow\: \color{orange}brainliest!

Answered by jeenalBaindha
0

Explanation:

Input : arr[] = {1, 2, 3}

Output : 6

1 + 2 + 3 = 6

Input : arr[] = {15, 12, 13, 10}

Output : 50

Similar questions