网络编程
位置:首页>> 网络编程>> Python编程>> 简单了解python中的与或非运算

简单了解python中的与或非运算

作者:Roc_Atlantis  发布时间:2021-03-20 01:45:02 

标签:python,与,或,非,运算

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


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中的与或非运算

来源:https://www.cnblogs.com/Roc-Atlantis/p/9094040.html

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com