我一直有一個問題,我正在處理一個簡單的代碼。它詢問你的名字,以及你的一天是如何的,並且根據你的答案,它應該做與該答案相關的行動。感謝您提前提供所有幫助。如果條件字符串失敗
import time
print "Hello."
time.sleep(.5)
print "What's your name?"
var = raw_input()
time.sleep(.3)
print "Hello", var
time.sleep(1)
print "How are you?"
i = 0
answer1 = False
answer2 = False
answer0 = False
repeat = True
while repeat == True:
if i == 0:
answer = raw_input()
if answer == "Good" or "good":
answer1 = True
if answer == "Bad" or "bad":
answer2 = True
if answer is not "good" or "Good" or "ok" or "Ok" or "OK" or "Not so good" or "not so good" or "Not so good." or "not so good.":
answer0 = True
if answer2 == True:
print "That sucks."
time.sleep(1)
print "Well that's end of my code", var
time.sleep(1)
print "See ya!"
break
if answer1 == True:
print "That's awesome!"
time.sleep(1)
print "Well that's end of my code", var
time.sleep(1)
print "See ya!"
break
if answer0 == True:
print "I'm sorry, I didn't understand you."
time.sleep(1.5)
print "Are you good, ok, or not so good?"
又是什麼代碼實際上做? –
...我們應該猜測它實際上**做了什麼嗎? –
如果有什麼打印出來是什麼? –