A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.w3schools.com/python/ref_func_sum.asp below:

Website Navigation


Python sum() Function

Python sum() Function

❮ Built-in Functions

Example

Add all items in a tuple, and return the result:

a = (1, 2, 3, 4, 5)
x = sum(a)

Try it Yourself » Definition and Usage

The sum() function returns a number, the sum of all items in an iterable.

Syntax Parameter Values Parameter Description iterable Required. The sequence to sum start Optional. A value that is added to the return value More Examples Example

Start with the number 7, and add all the items in a tuple to this number:

a = (1, 2, 3, 4, 5)
x = sum(a, 7)

Try it Yourself »

❮ Built-in Functions

Track your progress - it's free!


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4