title: Using binary search and recursion to search a text file
body: <p>I want to use recursion and binary search to search a text file for a username and password. Each account (username and password) are saved on one line, with a space separating the two.</p>
  <p>This is what I currently have (does work), just want to use more techniques:</p>
  <pre><code>def validation(username1, password1):
      file = open(&quot;Accounts.txt&quot;, &quot;r&quot;)
      for line in file:
          line = line.split(&quot;\n&quot;)
          line = line[0].split(&quot; &quot;)
  
          if username1 == line[0] and password1 == line[1]:
              main_menu()     #main_menu() will allow the user to enter the game
          else:
              valid = Label(root, text=&quot;Account not found try again or sign up&quot;)
              valid.place(x=215, y=130)
              login()        #will recall the login window and ask them to renter details 
      file.close()
  </code></pre>
  <p>I have the following code which I want to use:</p>
  <pre><code>def validation(username1, password1):
      file = open(&quot;Accounts.txt&quot;, &quot;r&quot;)
  </code></pre>
  <p>userame1 and passwrod1 are the details that the user have entered. I now want to check that an account has already been created using binary search and recursion.</p>
  <p>Amy ideas on how to do this? I'm still learning how to code.</p>