更新时间:2022-04-14 06:28:41
我建议使用以下功能:
def check(word, list):
if word in list:
print("The word is in the list!")
else:
print("The word is not in the list!")
这里假设您使用的是 Python 3.x,如果您使用的是 Python 2,那么您的打印语句中不应有括号
This is assuming you're using Python 3.x, if you're using Python 2, then there shouldn't be parenthesis in your print statements
希望这会有所帮助!