Python之逻辑运算符
'''逻辑运算 : 且 : and------全真则真,一假则假 或 : or------一真则真,全假则假 非 : not-----取反逻辑运算优先级 : () > not > and > or特殊逻辑运算(指见于面试题中,开发中及其少见) : num1 or num2 #当num1 == 0时,返回num2,num1 != 0时返回num2;and运算与之完全相反;例题分析 : 例题一:# False or True or ( False) or False# True or False or False# True or False# True 1 > 1 or 3 < 4 or 4 > 5 and 2 > 1 and 9 > 8 or 7 < 6例题二:#8 or ( 4 ) or ( 0 ) or ( 7 ) # 8 or 0 or 7# 8 or 7# 8 8 or 3 and 4 or 2 and 0 or 9 and 7'''
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。