0013 _ operator, 0013 Operator

Source: Internet
Author: User

0013 _ operator, 0013 Operator

1. Arithmetic Operators

+

-

*

/

% (Remainder)

// (Division)

Python2.7: 9/2 = 4

9/2 = 4.5 (import module from _ future _ import division)

Python3: 9/2 = 4.5

2. Comparison Operators

= Compare whether objects are equal

! = Compare whether two objects are not equal

<> Compare whether two objects are not equal

> Greater

<Less

> = Greater than or equal

<= Less than or equal

3. Value assignment operator

= Value assignment

+ = Auto-Increment

-= Auto-Subtraction

* = Self-Multiplication

/= Self-Division

4. logical operators

And

Or

Not no

5. member operators

In determines whether a = "alex SB" ret = "SB" in a print (ret) => True

Not in determines whether B = ['Alex ', 'Eric', 'rain'] ret = 'xb 'in B print (ret) => False

6. Identity Calculation

Is used to determine whether two identifiers reference an object x is y. If id (x) is equal to id (y), is returns result 1.

Is not

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.