0
變量c將不會在下面的代碼運行:的Python:在嵌套的變量,如果其他人將無法運行
A = raw_input("How are you today")
if A == "Good" or "Fine" or "good" or "fine" or "great" or "Great" or "Wonderful" or "wonderful":
print("I am glad you are having a good day")
B = raw_input("What made your day good")
if B == "everything" or "Everthing":
print("Everything! You must be having a very good day")
else:
print("It sounds like you had a very intersting day")
C = raw_input("Do you want to hear about my day? [y/n]")
if C == "y" or "Y":
print("I sat around as an unused computer!")
else:
print("I guess I am just an annoying computer")
else:
print("I am sorry you are having a bad day")
可能的重複[如何測試一個變量對多個值?](http://stackoverflow.com/questions/15112125/how-do-i-test-one-variable-against-multiple-values) –
請爲您的下一個StackOverflow問題正確格式化您的代碼。用不正確的縮進來調試Python是不可能的。在這種情況下,很容易看到發生了什麼,因爲你犯了一個非常常見的錯誤。請參閱相關問題以獲得答案。 –
最後的'else'語句沒有對應的'if'。 –