-1
scenario2(結果)函數調用sget_choice3,因此它會根據用戶的選擇打印結果。雖然沒有要求輸入兩次
我想函數循環並要求輸入兩次,如果用戶選擇是0(正確的是1,0只是它的一個分支)。
s2option_list3 =['Try to force it', 'Examine the door']
def sget_choice3(s2option_list3):
i = -1
while i <= 0:
print s2option_list3
choice3 = raw_input("> ")
for i, opt in enumerate(s2option_list3):
if opt in choice3:
i = i + 1
return i
else:
i = i + 2
return i
print "You need to select one of the given actions"
def scenario2_exit(outcome):
print outcome
choice = outcomes[0]
if outcome in choice:
print "conversation"
res3 = sget_choice3(s2option_list3)
if res3 == 0:
print "You try to force it but without any luck. However you do notice a little button on the left corner. "
else:
print "A small panel comes out, seems to be requesting a code. "
print "conversation"
else:
print "conversation"
你每天都在問幾乎同樣的問題相當多。難道不是你從我們提供的答案中學到了什麼嗎? –
不一樣的問題。 –