Python學習之not,and,or篇


Python學習之not,and,or篇

 

運算符示意

  • not –表示取反運算。
  • and –表示取與運算。
  • or –表示取或運算。

運算符優先級

not > and > or。 
舉例如下:

bool_one = False or not True and True print bool_one bool_two = False and not True or True print bool_two bool_three = True and not (False or False) print bool_three bool_four = not not True or False and not True print bool_four bool_five = False or not (True and True) print bool_five

程序輸出:

False True True True False


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM