Commit 5aba70c6 by BellCodeEditor

save project

parent a0b7a612
Showing with 8 additions and 4 deletions
......@@ -4,10 +4,13 @@ low = 0 #最低值
high = len(num_list)-1 #最高值
mid = (low + high)//2 #中间值
guess = num_list[mid]
if guess == num_list[mid]:
print("找到了")
elif guess < num:
while low == high:
if guess == num_list[mid]:
break
elif guess < num:
low = mid + 1
else:
else:
high = mid - 1
if low < high:
print("不存在")
print(guess)
\ No newline at end of file
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