面试题答案
一键面试- 使用
not in
运算符:
my_list = [10, 20, 30, 40, 50]
result = 60 not in my_list
print(result)
- 使用循环遍历列表:
my_list = [10, 20, 30, 40, 50]
found = False
for num in my_list:
if num == 60:
found = True
break
result = not found
print(result)