二分查找
def bin(alist,target):
i,j=0,len(alist)-1
while i<=j:
m = (i+j)//2
if target == alist[m]:
return m
if target > alist[m]:
i = m+1
else:
j = m-1
return "not found"
if __name__=="__main__":
alist = [1,2,3,5,8,9]
target = 5
index = bin(alist,target)
print(index)