raw_input을 실험하고 있는데 내 첫 번째 if
문과 내 else 문을 제외하고는 정상적으로 작동합니다. 코드를 실행하고 제 2 문항에 raw_input을 입력하면 (if
문에 'League'뒤에 나열), 첫 번째 if와 두 번째 질문 모두를 반환합니다. 첫 번째 문언은 if
인 경우에만 인쇄됩니다. 어떤 생각이 잘못된거야?여러 if 문이있는 조건문 (raw_input 포함)
name = raw_input('What is your name?\n')
game = raw_input('\nWhat MOBA do you play/have played? \n(The answer ' \
'must be case sensitive i.e. LoL for League and DoTA for y\'know the whole darn thing '\
'is too '\
'darn long to say even though I typed a lot more than the name)\n')
if game in ('League' , 'League of Legends' , 'LoL'):
print '\nYou go girl! '
if game in ('DoTA' , 'DoTA 2' , 'DoTA2'):
print '\nThat\'s cool and all but........ Go play League you dang noob. '
else:
print '\nAre you kidding me? You play %s? I\'m severely disappointed in you %s. You ' \
'should at least be playing ' \
'one of these popular games. \nShame, shame, shame. Go install one. ' % (game, name)
두 번째 'if'대신 ' elif' – Kamehameha