Commit 66c8154c by BellCodeEditor

save project

parent b097f043
Showing with 4 additions and 4 deletions
......@@ -8,14 +8,14 @@ num = random.choice(alist)
def binary_search(alist,num):
low = 0
high = len(num_list)-1
high = len(alist)-1
while low <= high:
mid = (low+high) // 2
guess_num = num_list[mid]
if guess_num == bingo_num:
guess= alist[mid]
if guess== num:
print('找到了','它的索引是',mid)
break
elif guess_num < bingo_num:
elif guess < num:
low = mid+1
else:
high = mid-1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment