title: Recursive binary search python
body: <p>I've been trying to write binary search recursively. When I do this using the list[:] syntax I don't get the intended results with several errors coming up or not getting the correct values. </p>
  
  <pre><code>def binary_search(arr, val):
  
    left = 0 
    right = len(arr)-1
    mid = (left + right)//2
  
    #Go through the array
     if (val == arr[mid]):
       return mid
     #Check right side of arr
     if (val &gt; arr[mid]):
       return binary_search(arr[mid+1:], val)
     #Check left side of arr
     return binary_search(arr[:mid], val)
  </code></pre>
  
  <p>EDIT: Example inputs and outputs</p>
  
  <pre><code>arr1 =[]
  for i in range(10):
      arr1.append(i)
  
  for i in range(10):
      print(binary_search(arr1,i))
  </code></pre>
  
  <p>I expect to get something like <code>'0,1,2,3,4,5,6,7,8,9'</code> but get <code>'0,1,0,0,4,None ,None,2,0,0'</code></p>