文章90
标签1
分类38

bool类型真假或与

a,b=1,2
#或->or (一真则真)
#和->and(一假则假)
print(a==1 or b==9)#1or0--->1
print(a==3 and b==2)#0and1---->0

#非 not 

a=True

print("否定",not a)#a变为false


#判断一段内容是否在一段字符串里面
"""

需要判断的内容 + in + 字符串


"""


text="zhang"


print("a"in text) #a在字符串 所以true
print("a"not in text) #a在字符串 ,但是判断不再错误,所以false

    0 评论

    ">