lst = [11,22,33,44,55,66,77,88,99] def func(left,right,n): middle = (left + right) // 2 if left > right: return - 1 elif n > lst[middle]: left = middle + 1 elif n < lst[middle]: right = middle - 1 else: return print('cunzai',middle) return func(left,right,n) func(0,len(lst) - 1,66) # 递归的方式实现二分查找