
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
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
Find Sum of 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
Advertisements