Python Day10 常用操作符补充
2017-04-27 本文已影响0人
读书的番茄
1、and
and 左侧及右侧均为真,结果才能为真;
2、or
左边或者右边,任意一边为真,结果即为真;
两边同事为假,结果才为假;
3、not
取相反值
>>> not True
False
>>> not False
True
>>> not 0
True
>>> not 4
False
image.png
and 左侧及右侧均为真,结果才能为真;
左边或者右边,任意一边为真,结果即为真;
两边同事为假,结果才为假;
取相反值
>>> not True
False
>>> not False
True
>>> not 0
True
>>> not 4
False
image.png