def begin():
response = input("Would you like to import a file? ")
response = response.lower()
if response is 'yes' or 'y':
return to_import()
else:
print("Bummer")
我的目标是只有yes或y响应才会返回该函数并启动程序的其余部分。问题是此刻的任何响应都会启动to_import()。
答案 0 :(得分:0)
尝试在if语句中分离两个条件:
if response is 'yes' or response is 'y':
return to_import()
else:
print("Bummer")