- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions

# 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 Articles
- Find the sum of array in Python Program
- Program to find running sum of 1d array in Python
- Program to find sum of the 2 power sum of all subarray sums of a given array in Python
- Program to find maximum weighted sum for rotated array in Python
- Program to find sum of absolute differences in a sorted array in Python
- Program to find out the sum of evenly spaced elements in an array in Python
- Java program to find the sum of elements of an array
- Python program to find the sum of sine series
- Python program to find the sum of dictionary keys
- Program to find sum of the sum of all contiguous sublists in Python
- Python program to find Sum of a sublist
- 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 the maximum sum of circular sublist in Python

Advertisements