Python Learning note 011--built-in function sum ()

Source: Internet
Author: User
Tags iterable
1 description

The sum () method sums the series.

2 syntax
Sum (iterable[, start])

Iterable: An object, such as a list, that can be iterated.

Start: Specifies the parameter to add, or 0 if the value is not set.

3 Example
Print (SUM ([0,1,2]))     # No second parameter, default is 0   3print#  tuple calculates the sum and then addstheprint#  The sum of the list is calculated and then added

Transfer from http://www.runoob.com/python/python-func-sum.html

Python Learning note 011--built-in function sum ()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.