2021.4.12
1.几个关键字
(1) and----相当于C语言里的&&
(2) or----相当于C语言里的 ||
(3)in-----用于判断列表是否包含某个元素的关键字
ps:检查不在就使用 not in
list_test = [1, 3, 5, 6, 8]
if 3 in list_test:
print('yes')
else:
print('no')
输出
yes
Process finished with exit code 0
2.比较字符串时,常用函数lower(),把比较对象都化为小写来比较
3.if语句的格式与for一样语句后有’:’