Commit c7fb1cbb by BellCodeEditor

save project

parent eb649662
Showing with 15 additions and 2 deletions
kun = [1,2,3,4,5,6,7,8,9,10]
mid1 = 5
low_kun = 0
high_kun = len(kun)
while high_kun >= low_kun:
mid_kun = (low_kun+high_kun)//2
if kun[mid_kun] == mid1:
print("找到了!索引是",mid_kun)
break
elif kun[mid_kun] < mid1:
low_kun = mid_kun + 1
else:
high_kun = mid_kun - 1
\ No newline at end of file
......@@ -26,4 +26,4 @@ pen.backward(150) # 后退
pen.down()
tree(120)
turtle.done()
\ No newline at end of file
turtle.done()
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