title: Python Binary Search while loop doesn't break
body: <p>I am using binary search on Python to solve the following problem: you have a list of n positive integers: a0, a1, a2, ... an-1, in increasing order.</p>
  
  <p>Now, your friend is going to ask you m questions, each of the form, "Here is a positive integer B. Is B a part of the list?"</p>
  
  <p>If B is in the list a, you will say "Yes".</p>
  
  <p>Your task is to output the number of times you say yes for any given inputs.</p>
  
  <p>1 ≤ n ≤ 10^5, 1 ≤ m ≤ 10^5 and 1 ≤ A, B ≤ 10^9</p>
  
  <p>I wrote up the following code:</p>
  
  <pre><code>n = int(raw_input())
  a = [int(x) for x in raw_input().split()]
  m = int(raw_input())
  
  answer = 0
  
  lo = 0
  hi = len(a) - 1
  end = False
  
  for i in range(0, m):
      B = int(raw_input())
      while (lo &lt;= hi):
          mid = int((lo + hi) / 2)
          if B == a[mid]:
              answer = answer + 1
              break
          elif B &lt; a[mid]:
              hi == mid - 1
          elif B &gt; a[mid]:
              lo == mid + 1
  
  print answer
  </code></pre>
  
  <p>I tested it out in terminal, and it just never outputs an answer, instead, I just keep writing in numbers (even letters) into the terminal endlessly. Input for n, a, m, and the first value of B has been successful since terminal gives me error message if I type a letter, but after the first 4 lines, it just doesn't respond to whatever I type, until I used ctrl Z to break out of Python.</p>
  
  <p>Would anyone please address why this is the case? I have tested out this program by hand as well, and it should have worked.</p>
  
  <p>Thank you. </p>