5-1 条件测试
things=['apple','dog','I','You','he','she','friends']
print('Is 'cat' in things? I guess no!')
'cat' in things #False,因为things列表中没有'cat'这项
things=['apple','dog','I','You','he','she','friends']
print('Is 'cat' in things? I guess no!')
'cat' in things #False,因为things列表中没有'cat'这项
print('Is 'dog' in things? I guess no!')
'dog' in things #True,因为'dog'在things中
'dog' in things #True,因为'dog'在things中
print('Is 'DOG'.lower() in things? I guess no!')
'DOG'.lower() in things #True,因为'DOG'的小写为'dog'
'DOG'.lower() in things #True,因为'DOG'的小写为'dog'
print('Is "dog" in things? I guess yes!')
"dog" in things #True,不区分双引号和单引号
"dog" in things #True,不区分双引号和单引号
thingss=('apple','dog','I','You','he','she','friends')
print('Is thingss==things? I guess no!')
thingss==things #False,列表与元组不同
print("Are both 'dog'