Commit f42de405 by BellCodeEditor

save project

parent 4e3f708f
Showing with 10 additions and 13 deletions
...@@ -5,15 +5,12 @@ low=0 ...@@ -5,15 +5,12 @@ low=0
high =len(num_list)-1 high =len(num_list)-1
while low <= high: while low <= high:
mid = (low+high)//2 mid = (low+high)//2
guess = num_list[mid] guess = num_list[mid]
if high < low: if guess == number:
print("没有这个数") print("索引值",mid)
else: break
if guess == number: elif guess < number:
print("索引值",mid) low = mid+1
break else guess > number:
elif guess < number: high = mid-1
low = mid+1 print("没有这个数")
elif guess > number: \ No newline at end of file
high = mid-1
\ 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