title: How to restart this program
body: <p>So this is my code that works fine alone.....    </p>
  
  <pre><code>def program():
     for x in y:
        for g in t: 
            if x == g:
               return True
  
      return False 
  
  print ("Welcome")
  y = input(" enter...").lower().split()
  
  with open("pro.txt", "r")as file:
  lines = file.readlines()
  
  o = False
  
  for line in lines:
  item = line.split("-")
  t = item[0].split()
  a = item[1]
  
  if program():
      print (a)
  
      o = True 
  
  if o == False:
  print ("sorry")
  </code></pre>
  
  <p>I did ask this question before, but I didn't explain well enough. so the problem I have here is that I do not know how to restart this program one of my attempts was this.....</p>
  
  <pre><code>def restart():
  answer = ''
  while answer not in ('y','n'):
      answer = input('Run again? (y/n): ')
  
  if answer == 'y':
      return program()
  
  if answer == 'n':
      return False
  
  else:
      return None    
  while restart() == True:
  program()
  </code></pre>
  
  <p>This code is at the bottom
  however this didn't seem to work as I answer the question with 'y' or 'n' didn't seem to work as when I answer the program ends. so my question is why doesn't it work and how will you make it work. Thanks.</p>