二分法迭代判断数是否在数组中,程序却无法判断

最终我的程序始终无法找到这个数字。
程序如下:

#二分法判断数字是否存在在函数中
def binary_search(list_sort, size, target):
    count_dipole = 1
    def dipole(size):
        if size % 2 ==0:
            return int(size/2)
        else:
            return int((size-1)/2)
    if target == list_sort[dipole(size)]:
        return 1
    elif target < list_sort[dipole(size)]:
        binary_search(list_sort[0:dipole(size)], dipole(size), target)
        count_dipole += 1
    elif target > list_sort[dipole(size)]:
        binary_search(list_sort[dipole(size):-1], dipole(size), target)
        count_dipole += 1
try:
    binary_search([1,2,3,4,5,6,7,8,9,10,11], 11, 11)
except:
    print(-1)

结果如下

img

切片那里把-1删掉,那样的话就不包含最后一个元素了,所以找不到