0
是的,我是新來的,我很難學習。這讓我非常困惑。我嘗試了幾個小時來創建一個循環,如果變量的值不是它應該的值,它會繼續詢問raw_input,直到它應該是什麼,然後程序移動到下一個函數,並顯示一些東西像「再試一次」這可能很簡單,但我無法弄清楚。我以後first_action的raw_input =談論的代碼( 「>>」)我似乎無法理解循環
def start():
print """You awaken in a strange lanscape, You are on a steep hillside
surrounded by trees, and you can see large mountains in the distance."""
print "....."
print "....."
print "You struggle to regain your senses, and you realize you don't know who you are, or how you got here."
print "You have the following items: %s" % i
print "It's dark, perhaps you should sleep until the sun rises."
print "What do you do?"
def cryptic_message(read):
print read, "A paper with a message written in a strange language."
def day_1():
print "_-_-_Dream_-_-_"
print "It is relativity. It is a concept you know as time."
print """This time, what is it? You ask "me" and I do not know. Ask yourself."""
print """It is illusion. Oh look, "time" to wake up!"""
print "....."
print "....."
print "You awaken, dazed and tired"
print "What do you do?"
def knife(cut, stab):
print "What do you want to do with the knife?"
knife = raw_input(">> ")
def photo(view):
print "A faded photo of a man on a park bench"
i = ['clothing','small knife','strange photo','cryptic message']
start()
first_action = raw_input(">> ")
first_action == False
while first_action is False:
if first_action == "sleep":
print "You lay on the grass for a hardly restful sleep."
first_action == True
day_1()
elif first_action == "do nothing":
print "Try again"
first_action == False
else: "Try again"