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

python学习30300509逻辑运算短路原则

时间:2020-05-09 10:40:38      阅读:58      评论:0      收藏:0      [点我收藏+]

标签:python学习   als   解析   pytho   and   学习   python   根据   判断   

短路原则

对于and 如果条件1为假,and后面的条件短路,不用判断一定为假

对于or,如果条件1为真,or  后面的条件短路,不用判断一定为真

 

not not true or false  and not true

true

not not true为真,or的短路原则(false  and not true)被短路

true  or  true and false

true

 

解析:true  为ture,根据or 短路原则,true and false被短路不计算就是true

 

python学习30300509逻辑运算短路原则

标签:python学习   als   解析   pytho   and   学习   python   根据   判断   

原文地址:https://www.cnblogs.com/wangyunpeng888888/p/12855648.html

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