What function should I use to fix my code?
Question: I'm an amateur trying to code a simple troubleshooter in Python but I'm sure
what function I need to use to stop this from happening... [enter image
description here](http://i.stack.imgur.com/XJsB1.png)

What should I do so the code doesnt continue running if the user inputs yes?

    
    
      TxtFile =open('Answers.txt')
    lines=TxtFile.readlines()
    import random
    def askUser(question):
        answer = input(question + "?  ").lower()
        Split = answer.split()
        if any(word in Split for word in KW1):
            return False
        elif any(word in Split for word in KW2):
            return True
        else:
            print("Please answer yes or no.")
            askUser(question)
    
    KW1=["didn't", "no",'nope','na'] #NO
    KW2=["did","yes","yeah","ya","oui","si"] #YES
    print (lines[0])
    
    print("Nice to meet you, " + input("What is your name? "))
    print("Welcome to my troubleshooter")
    #This is the menu to make the user experience better
    shooter=True
    while shooter:
       print('\n\n1.Enter troubleshooter\n2.Exit\n\n')
       shooter=input('Press enter to continue: ')
       if shooter==('2'):
           print('Ok bye') 
           break
    
    
    
    words = ('tablet', 'phone', 's7 edge')
    while True:
        question = input('What type of device do you have?: ').lower()
        if any(word in question for word in words):
                print("Ok, we can help you")
                break                
        else:
                print("Either we dont support your device or your answer is too vague")
    
    if askUser("Have you tried charging your phone"):
        print("It needs to personally examined by Apple")
    else:
        if askUser("Is it unresponsive"):
            print (lines[0])         
        else:
            print ("Ok")
        if askUser("Are you using IOS 5.1 or lower"):
            print (lines[1])
        else:
            if askUser("Have you tried a hard reboot"):
                print (lines[2]) 
            else:
                 if askUser("Is your device jailbroken"):
                     print (lines[3])
                 else:
                      if askUser("Do you have a iPhone 5 or later"):
                          print (lines[4])
                      else:
                          print(lines[5])
                 print ('Here is your case number, we have stored this on our system')         
                 print (random.random())
    

Here is my code for reference.

Edit: Here is the problem [enter image description
here](http://i.stack.imgur.com/XJsB1.png)

It should just end the code there but it doesnt. I'm not sure how I can fix it


Answer: I would recommend moving the following:

    
    
       if askUser("Are you using IOS 5.1 or lower"):
            print (lines[1])
        else:
            if askUser("Have you tried a hard reboot"):
                print (lines[2]) 
            else:
                if askUser("Is your device jailbroken"):
                    print (lines[3])
                else:
                    if askUser("Do you have a iPhone 5 or later"):
                      print (lines[4])
                  else:
                      print(lines[5])
                  print ('Here is your case number, we have stored this on our system')         
                  print (random.random())
    

into the else part of:

    
    
    if askUser("Is it unresponsive"):
    

Hope this helps.

