Python3 Digit (number)

Source: Internet
Author: User
Tags mathematical constants mathematical functions

The 1.Python numeric data type is used to store numeric values.

The data type is not allowed to change, which means that if you change the value of the numeric data type, the memory space will be redistributed.

The 2.Python supports three different numeric types:

    • Integer (Int) -usually referred to as an integer or integral, is a positive or negative integer, with no decimal points. The Python3 integral type is not limited in size and can be used as a long type, so Python3 does not have a long type of Python2.
    • float (float) -floating-point type consists of integral and fractional parts, and floating-point types can also be represented using scientific notation (2.5e2 = 2.5 x 102 = 250)
    • complex numbers ((complex)) -complex numbers are composed of real and imaginary parts, and can be represented by a + BJ, or complex (a, b), where both the real and imaginary part of a complex number are floating-point types.

3.Python Numeric Type conversions

Sometimes, we need to convert the data-built type into the data type, and you just need to use the data type as the function name.

    • int (x) converts x to an integer.

    • float (x) converts the x to a floating-point number.

    • Complex (x) converts x to a complex number, the real part is x, and the imaginary part is divided into 0.

    • complex (x, y) converts x and y to a complex number, the real part is x, and the imaginary part is Y. X and y are numeric expressions.

4.Python Digital Arithmetic

The Python interpreter can be used as a simple calculator, and you can enter an expression in the interpreter that will output the value of the expression.

The syntax of an expression is straightforward: +,-, * and/and other languages (such as Pascal or C).

A variable must be "defined" (that is, given a variable value) before it can be used, or an error will occur:

Note: 1. converting integers into floating-point numbers when mixing operations of different types:

2. In interactive mode, the result of the last expression output is assigned to the variable _ .

3._ variables should be treated as read-only variables by the user.

5. Related functions: Mathematical functions, random number functions, trigonometric functions, mathematical constants.

Python3 Digit (number)

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.