码迷,mamicode.com
首页 > 编程语言 > 详细

python的与或非运算

时间:2018-05-26 20:24:02      阅读:17978      评论:0      收藏:0      [点我收藏+]

标签:运算符   ima   .com   false   python运算符   class   alt   图片   IV   

真的很重要,栽了个跟头!!!(虽然以前好像知道。。。)

print(True or False and False)

print((True or False) and False)

# True
# False

这里有一个python运算符的优先级

 

not > and >or  

not > and >or

not > and >or

有括号的除外

运算返回的值是决定表达式运算结果的值。

比如True or False 、False or True返回True,True and False返回False。

技术分享图片

 

python的与或非运算

标签:运算符   ima   .com   false   python运算符   class   alt   图片   IV   

原文地址:https://www.cnblogs.com/Roc-Atlantis/p/9094040.html

(0)
(4)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!