Python learning [logical operations]

Source: Internet
Author: User

Logical operations are one of the most fundamental skills to examine our logical capabilities:

First we need to know the meaning of these three words and or not

And: And

Or: OR

Not: True or FALSE, true or false

Boolean operations:

And: Both values are true and the result of the operation is true and true =true as long as there is a false: true and False=false

Or: Both ends as long as one is true is true: TRUE or false=true as long as one is true

Not True=false, not false=true

The order of operations for and or not.

Order of Operations () >not>and>or

Logical operation:

Or: If two numbers do a logical operation such as x or Y. If x =0 then the result is Y. If x>0 is X

And: In contrast to or

Practice:

1), 6 or 2 > 1      6
2), 3 or 2 > 1 3
3), 0 or 5 < 4 False
4), 5 < 4 or 3 3
5), 2 > 1 or 6 True
6), 3 and 2 > 1 True
7), 0 and 3 > 1 0
8), 2 > 1 and 3 3
9), 3 > 1 and 0 0
10), 3 > 1 and 2 or 2 < 3 and 3 and 4 or 3 > 2 2

Python learning [logical operations]

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