# ###身份证运算符 is 和 is not(检查两个数据在内存当中是否是同一个值)
var1 = 6
var2 = 6
print(id(var1),id(var2))
var1 = "好"
var2 = "不好"
# is用来判断2个变量的地址是否一致
res = var1 is var2
print(res)
res =var1 is not var2
print(res)
# var1 == var2 与 var1 is var2 区别
"""
一个是比较两个值是否相同
一个是比较两个值的地址是否相同
"""
# ### 逻辑运算符 and or not
print("<======>")
#and 逻辑与
'''全真则真,一假则假'''
res = True and True
res = True and False
res = False and True
res = False and False
print(res)
# or 逻辑或
"""全假则假,一真则真"""
res = True or True
res = True or False
res = False or False
res = False or True
print(res)
# not 逻辑非
'''真变假,假变真'''
res = not False
res = not True
print (res)
#(1) 逻辑短路(后面的代码就不走了)
'''
两种情况
res = False and 布尔值
res = True or 布尔值
'''
# print默认返回一个None 而None的布尔值是假
# res = False and print(1)
res = True and print(2)
res = True or print(3)
res = False or print(4)
print(res)
#逻辑运算符优先级
'''() > not > and > or'''
# (5+6)*3
res = 5 or 6 and 7
# 5 or 7 =>5
res = (5 or 6) and 7
# 5 and 7 =>7
res = not (5 or 6) and 7
# | (5 or 6) => 5 | not 5 =>False | False and 7 => False
res = 5>6 or 7<8 and 9>10 or 11<12
'''
False or True and False or True
False or False or True
False or True =>True
'''
print(res)
'''
有一种情况不用考虑and 和 or优先级问题
就是or短路 比如 True or .........=>结果一定为 True
'''
# ### 数据类型的判断 isinstance
'''
isinstance(要判断的数据,判断的类型)要么返回真,要么返回假
isinstance(要判断的数据,(元组,放上各种类型,满足一个条件即为真))
'''
print("<=========>")
# 5 是int 类型的么
res = isinstance(5,int)
res = isinstance("678",list)
print(res)
#有一个类型满足 返回真,一个不满足返回假
res = isinstance(5,(list,tuple,str,int))
print(res)