- Related Questions & Answers
- Python Program to find the sum of array
- Program to find running sum of 1d array in Python
- Program to find sum of the sum of all contiguous sublists in Python
- Python program to find the sum of sine series
- Java program to find the sum of elements of an array
- Program to find the maximum sum of circular sublist in Python
- Program to find the sum of largest K sublist in Python
- Find sum of elements in list in Python program
- Python program to find sum of elements in list
- Program to find sum of unique elements in Python
- Program to find sum of contiguous sublist with maximum sum in Python
- Program to find the sum of all digits of given number in Python
- C/C++ Program to find the sum of elements in a given array
- Python program to find the sum of all items in a dictionary
- Program to find the sum of first n odd numbers in Python

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

In this article, we will learn about the solution to the problem statement given below.

**Problem statement **− We are given an array we need to compute the sum of the array.

The brute-force approach to traverse the whole array and element at each index to obtain the sum is discussed below at each index to obtain the sum is discussed below

# sum function def sum_(arr,n): # using built-in function return(sum(arr)) # main arr = [11,22,33,44,55,66] # length n = len(arr) ans = sum_(arr,n) # display sum print("Sum of the array is ",ans)

Sum of the array is 231

All the variables are declared in the local scope and their references are seen in the figure above.

In this article, we have learned how to print the sum of array

Advertisements