The basics of Python programming seven

Source: Internet
Author: User

Operational relationships: That is, the comparison operation is often said, the return value is only true, False

= = Whether the judgment is equal

! = Determine if not equal

>,<, >=, <= judgment is greater than, less than, greater than or equal to, less than or equal to

Comparison operator Precedence is all the same

From left to right

Logical operations: basic terminology constructs complex conditions

And and

OR OR

Not opposite

Priority: not > and > or

A b A and b A or B not a

True arbitrary value B value a value false

False arbitrary value a value B value true

Short Circuit calculation:

For and, when the left operand is false, the right operand is shorted and will not be computed

For or, when the left operand is true, the right operand is shorted and is not evaluated

Identity operator: is, the term to determine whether two identifiers from the same entity, the principle is to compare the ID of two objects, if the same, true, otherwise false

Is isn't the opposite

The ID () function can get the ID of the object

= = Determines whether two variable values are equal, but the IDs are not necessarily equal

Member operators:

In: Returns TRUE if the specified value is found in the specified sequence, otherwise false

Not in: Returns TRUE if the specified value is not found in the specified sequence, otherwise false

The basics of Python programming seven

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.