def binary_search(list,item):
low = 0
high = len(list)-1
sum = 0
while low <= high:
mid = (low+high)//2 #整除
guess = list[mid]
sum +=1 #猜测次数+1
if guess == item:
return mid,sum
if guess > item:
high = mid - 1
else:
low = mid + 1
return None
my_list=range(99)
print(binary_search(my_list,25))
# my_list=[1,4,6,8,23]
#
# print(binary_search(my_list,4))