# How to use the Python sum() Function The Python `sum()` function is used to get the sum of all elements in an iterable.

## sum() Syntax

`sum()` takes two arguments, the iterable and the start value.

``````sum(iterable, [start])
``````

• `iterable` – any iterable data such as a string, dictionary or list.
• `start` – an optional argument to specify where to start counting from. If not supplied `sum()` will start at 0.

## Get Sum of List Elements

The example below demonstrates how to get the sum of all elements in a Python list.

``````items = [1, 5, 10]

result = sum(items)

print(result)
``````
``````16
``````

## Get Sum of Iterable Plus N

Here is another example demonstrating how to generate a sum with an additional value to add to the final result:

``````items = [1, 5, 10]

result = sum(items, 2)

print(result)
``````
``````18
``````

#### Related Tutorials ### How to Calculate Mean, Median, Mode and Range in Python

October 07, 2020 ### How to use Sets in Python

September 15, 2020 ### How to use the Python reduce() Function

June 22, 2021 ### How to Get the Average of a List of Numbers in Python

May 04, 2022 ### Sum of an Array in JavaScript

September 18, 2021 ### How to use the JavaScript reduce() Method

November 06, 2020