我正在用Python构建终端的交互式时间表,但是在我的代码末尾,如果我有if,elif和else语句,无论用户输入什么,我都会传递if声明。任何解决方案将是极大的赞赏,并感谢您的时间:)Python:Elif和Else无法正常工作
while True:
TimeTable()
print "\nDo you wish to go again? "
answer = raw_input()
if answer == "Yes" or "yes":
print " "
continue
elif answer == "No" or "no":
print "Ok then"
break
else:
print "Ok then"
break
'回答== “是” 或回答== “是”' 做这样 –
或最好'answer.lower()== “是”' –
尝试,如果答案==“是”或答案==“是”:'与'elif'一样。 – Ashan