运算符
# and or not # and:两边都是ture ,才是ture,只要有一个是false,结果是false # 优先级:()>not>and>or # print(2 > 1 and 1 < 4 or 2 < 3 and 9 > 6 or 2 < 4 and 3 < 2) '''x or y x为非零(True),则返回x''' #ps int 转换成bool 非零转换成 bool 是frue, 0 转换成bool 是 False # print(bool(2)) #True # print(bool(-2)) #True # print(bool(0)) #False # #bool ---> int # print(int(True)) #1 # print(int(False)) #0 # print(1 or 2) #1 # print(3 or 2) #3 # print(0 or 2) #2 # print(0 or 100) # 100 #print(2 or 100 or 3 or 4) # 2 """x and y x为非零(True),则返回Y""" #print(1 and 2) #2 #print(0 and 2) #0 print(0 or 4 < 3) # False print(2 or 4 < 3) # 2 print(2 or 2 < 3) # 2 print(0 or 2 < 3) # True print(3 > 2 or 0 and 2) #课后题 True print(3 > 4 or 0 and 2) #课后题 0