Python 03 Common operators

Source: Internet
Author: User
Tags arithmetic operators floor division

1. e notation, scientific counting method.

AeB A, B is an integer, a*10 the second party.

2. Logic operation, True 1, False is 0, it is best not to use this calculation

True (1) False (0)


3. Type conversion

integer int () floating-point number float () string str ()

>>> a=5.2
>>> A
>>> Int (a)
>>> Str (a)
' 5.2 '
>>> Float (a)

4. Type () determines the data type within the function

Isinstance (A,STR) The first is the data, the second is the data type, and the judgement is consistent

5. * */arithmetic operators

A + = 1 a-=1 a *=1 a/=1


>>> 10//8//integer except integers get integers (decimal, floor Division)
>>> 10/8
>>> 10.0/8

3 * * 2 = 9 3 2-Time Square

6. Priority level

-3 * * 2 =-9-(3**2)

Number of operations

PLUS sign

Arithmetic operator +-*///%

Comparison Operators > <

Logical operator not and OR

7. Logical operators

And both sides are true, true side (arbitrary) is false, false

or one side (any) is true, True and False, False

Not negation

Python 03 Common operators

Related Article

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: 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.