Python Basics (ii)

Source: Internet
Author: User

5 built-in functions for >> numeric operations

->abs (), returns the absolute value of the given parameter

->coerce (), which returns a tuple that contains the two numeric elements of a type conversion. (The type of the two numeric elements is consistent after conversion)

->divmod (), returns a tuple containing quotient and remainder

->pow (), if two parameters are accepted, an exponential operation is performed, and if 3 parameters are accepted, the exponential operation is performed first, then the result of the operation and the third parameter are taken.

->round (), rounding a number and returning a float. It has an optional number of decimal digits parameter. The decimal digits parameter indicates the number of digits specified after the decimal point is accurate

Comparison:

Int () truncates the fractional part directly. (The return value is an integer)

Math.floor () Gets the integer closest to the original number but less than the original number. (return value is floating point)

Round () gets the integer nearest to the original number. (return value is floating point)

Python Basics (ii)

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.