- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

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

# Python Program to find the sum of array

In this article, we will learn about the solution and approach to solve the given problem statement.

## Problem statement

Given an array as an input, we need to compute the sum of the given array.

Here we may follow the brute-force approach i.e. traversing over a list and adding each element to an empty sum variable. Finally, we display the value of the sum.

We can also perform an alternate approach using built-in sum function as discussed below.

## Example

# main arr = [1,2,3,4,5] ans = sum(arr,n) print ('Sum of the array is ',ans)

## Output

15

All the variables & functions are declared in the global scope and are shown below.

## Conclusion

In this article, we learnt about the approach to find the sum of an array.

- Related Questions & Answers
- Find the sum of array in Python Program
- Program to find running sum of 1d array in Python
- Java program to find the sum of elements of an array
- Python program to find the sum of sine series
- Program to find sum of the sum of all contiguous sublists in Python
- Program to find sum of the 2 power sum of all subarray sums of a given array in Python
- Program to find out the sum of evenly spaced elements in an array in Python
- Program to find sum of absolute differences in a sorted array in Python
- Program to find the maximum sum of circular sublist in Python
- Program to find the sum of largest K sublist in Python
- Program to find maximum weighted sum for rotated array in Python
- Python program to find sum of elements in list
- Python program to find Cumulative sum of a list
- Program to find sum of unique elements in Python
- Program to find sum of contiguous sublist with maximum sum in Python

Advertisements