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