
- 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
How to find sum a list of numbers in Python?
Python's built-in function sum() returns sum of numbers in an iterable object such as list or tuple. It takes two arguments, initial value which is optional and 0 by default and iterable object
Example
>>> l1=[10,20,30,40,50] >>> ttl=sum(l1) >>> ttl 150 >>> ttl=sum(range(10)) >>> ttl 45
- Related Articles
- Program to find sum of widths of all subsequences of list of numbers in Python
- Program to find kpr sum for all queries for a given list of numbers in Python
- How to find the greatest number in a list of numbers in Python?
- Python program to find Cumulative sum of a list
- How to Find Sum of Natural Numbers Using Recursion in Python?
- How to Find the Sum of Natural Numbers using Python?
- Python program to find sum of elements in list
- Program to find missing numbers from two list of numbers in Python
- Program to find maximum sum of multiplied numbers in Python
- Program to find minimum possible sum by changing 0s to 1s k times from a list of numbers in Python?
- Find sum of elements in list in Python program
- Find groups of strictly increasing numbers in a list in Python
- Program to find largest sum of non-adjacent elements of a list in Python
- Program to find sum of first N odd numbers in Python
- Program to find sum of odd elements from list in Python

Advertisements