parameters: (L,t)
return_statement: return best
docstring: Find the index of the closest value in a list.
      
      Input:
      L -- the list
      t -- value to be found
      
      Output:
      index of the closest element
docstring_summary: Find the index of the closest value in a list.
      
      Input:
      L -- the list
      t -- value to be found
      
      Output:
      index of the closest element
docstring_tokens: Find the index of the closest value in a list . Input : L -- the list t -- value to be found Output : index of the closest element
function: def find_closest_index(L,t):
      """
      Find the index of the closest value in a list.
      
      Input:
      L -- the list
      t -- value to be found
      
      Output:
      index of the closest element
      """
      beginning = 0
      difference = abs(L[0] - t)
      best = 0
      end = len(L)
      while beginning < end:
          middle = int((end+beginning)/2)
          if abs(L[middle] - t) < difference:
              difference = abs(L[middle] - t)
              best = middle
          if t == L[middle]:
              return middle
          elif L[middle] > t:
              end = middle
          else:
              beginning = middle + 1
      return best
function_tokens: def find_closest_index ( L , t ) : beginning = 0 difference = abs ( L [ 0 ] - t ) best = 0 end = len ( L ) while beginning < end : middle = int ( ( end + beginning ) / 2 ) if abs ( L [ middle ] - t ) < difference : difference = abs ( L [ middle ] - t ) best = middle if t == L [ middle ] : return middle elif L [ middle ] > t : end = middle else : beginning = middle + 1 return best