title: Returning the number before a given number in a list
body: <p>I am trying to write a binary search that will yield the highest number before a given number in an ordered list.  </p>
  
  <pre><code>y = int(input("Enter a number:"))
  numblist = [5, 8, 9, 10, 18, 20, 25, 28, 30, 35]
  
  lowerval = numblist[0]
  higherval = numblist[9]
  number = 0
  
  mid = (higherval + lowerval)//2
  
  for y in numblist:
     number += 1
  if mid == y:
     print(number)
     break
  
  if mid &lt; y:
      lowerval = mid
  else:
      higherval = mid
      mid = (higherval + lowerval)//2
  </code></pre>
  
  <p>For example, if I input 20, the number returned should be 18.  I honestly do not know how to call the right location.  I am extremely new at python, so any help would be appreciated.  </p>