我不明白爲什麼這個函數不打印我想要它打印的文本,我可以改變什麼?函數與if語句
def shut_down(answer):
if answer == "Yes" or "YES" or "yes":
print "Shutting down..."
return "Shutting down..."
if answer == "No"or "NO" or "no":
print "Shutdown aborted!"
return "Shutdown aborted!"
else:
print "Sorry, I didn't understand you."
return "Sorry, I didn't understand you."
shut_down(yes)
它總是有用的添加標記爲你的問題所涉及的語言,以便熟悉該語言的人們看到它。請[編輯]添加它。謝謝。 –
也很好解釋什麼是不工作,你期待什麼和你得到什麼結果。 – mb14