比较运算符
# 一般情况下 比较运算符在数字时间运用比较多 a= 3 b= 5 print(a == b) #false print(a != b) #True print(a > b) #false print(a < b) #True print(a >= b) #false print(a <= b) #True c ="zb123456" d = "zb123456" print(c ==d) #True print(c !=d) #false
逻辑运算符
a = 1 b = 2 c = 3 # and 左右两边只要有False 整体表达式就为False print(a > b and c > b) #False print(a < b and c > b) #True # or 左右两边只要有True 整体表达式就为True print(a == b or c > a) # True print(a > c or c < b) # False #逻辑运算 print(not a != c) # False #数据类型True False判断 print(0 and 1)
if条件语句