#利用递归进行二分查找 def data_find(data,goal): mid=int(len(data)/2) print(mid) if mid>=1: if data[mid]>goal: data_find(data[:mid],goal) elif data[mid]<goal: data_find(data[mid:],goal) else: print('找到了:',goal) else: print('不存在中位数') if __name__=='__main__': data_find(list(range(0,100)),72)