title: nesting and breaking for loops
body: <p>I want to search for keywords in a input that I have asked the user and if the keywords are in the input I want my code to open specific text file (I am using cakes as an example. But if none of the keywords are found I want it to ask the question again.</p>
  
  <p>However I am having trouble ending the loop as it keeps on asking the question. I have tried to keep my code to a minimum but I can always post more if requited.</p>
  
  <pre><code>keywords1 = ['jam', 'victoria', 'sponge', 'recipe', 'ingredients']
  keywords2 = ['chocolate', 'cake']
  keywords3 = ['tiramisu']
  
  def test1():
      global keywords1, keywords2, keywords3, query
  
      for i in keywords1:
          if i in query:
              f=open('Victoria.txt','r')
              f.read = f.read()
              for i in range(0,1):
                  print(f.read)
              f.close()
  
      for i in keywords1:
          if i not in query:
              question1()
          break
  
  def question1():
      global query
      query = input("\nWhat ingredients do you want?\nmake sure to include the keywords\n")
      test1()
  
  if __name__ == "__main__":
      question1()
  </code></pre>
  
  <p>I then want to this again for <code>n</code> amount of times as it works with only one loop, any help would be appreciated. </p>