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