-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"
: 뭔가처럼 당신에게 당신의 프로그램을 재구성하는 방법에 너무 많은 조언을 제공하지 않고
는 간단한 수정 될 수 있습니다. 우리가 제공하는 답변에서 뭔가를 배웠던 때가 아닙니까? –
같은 질문이 아닙니다. –