operator not, and, or in Python

Source: Internet
Author: User

  • Priority level

    1. And and 2. or or 3. Not non-

  • Operation

    Keep in mind that the number nonzero is false for true , and true to true false for false.

    any one really is true, the same false is False (because to check whether there is true, So the false case value is the last False value , for example: 0 or False is false;false or 0 is 0. True, the value is the first truth , for example: 0 or 1 or 2 is 1;0 or False or 2 is 2 )


    any one false is False, the same true as true (because to check whether there are false, So the real case is the last true value , for example: True and 1 is 1;1 and true is true. False in case the value is the first false value , for example: 0 and 1 and 2 for 0;true and false for False;true and 0 and False for 0)


    Not: Negates the result of a high-priority operation , the value is Boolean (2 is true, negation is false: false)

  • Not 2:false

    Not 1 and 2:false

    Not 1 or 2:false

    Not 1:true

    Not 0:true


    In fact, not just in Python, all languages follow this logic, and the question may be


    operator not, and, or in Python

    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.