Name=str(input("Your name is? "))
print("Hello,",Name,"!")
Age=int(input("And how old might you be? "))
print("So you are",Age,"years old?")
print("So on your next birthday, you will be",Age+1,"?")
agecorrect=str(input("Yes or no? "))
yes= in ["Yes","yes","Y","y","yes.","Yes."]
no= in ["No","no","N","n","no.","No."]
if agecorrect=yes:
print("Yes, I was right!")
else
if agecorrect=no:
realage=int(input("So your real age on your next birthday will be? "))
print("So you're actually going to be",realage,"? Good to know!")
else
print("I don't understand... I asked for a yes or no answer.")
對不起,如果此問題之前已被問到,但我不知道爲什麼我的代碼不工作,我需要一些幫助。謝謝。 (順便提一句,Python 3.5.1)python if語句字符串
的錯誤信息會清楚地告訴你,你有無效的語法'是=以... '。 –
'in [「是」,「是」,「是」,「是」,「是」,「是」。]'那是什麼? – Maroun
@MarounMaroun是的所有可能的答案是 – SirParselot