python 2.7 - While Loop being interrupted when if statement is false -


i have piece of code meant ask blank word should , moves on next 1 if correctly guess. part working fine, if enter wrong answer should ask question again not doing that. instead python shell sits there blank, no error, nothing. can't see problem:

while victory == false:     if askq == answerx[counter]:         newstring = newstring.replace(blank_list[counter],answerx[counter])         counter += 1         print newstring         if counter < len(blank_list):             askq = raw_input('what word ' + blank_list[counter] + '? ')     if newstring == answers:         print 'congratulations!'         victory = true 

i think figured out! there may better way, worked:

while victory == false:     if askq == answerx[counter]:         newstring = newstring.replace(blank_list[counter],answerx[counter])         counter += 1         print newstring         if counter < len(blank_list):             askq = raw_input('what word ' + blank_list[counter] + '? ')     else:         print newstring         askq = raw_input('what word ' + blank_list[counter] + '? ')     if newstring == answers:         print 'congratulations!'         victory = true 

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -