Commit 05555afd by BellCodeEditor

save project

parent f03861ef
Showing with 7 additions and 3 deletions
# 使用二分查找法,找出9和20在列表里面的索引
num_list = [1, 3, 5, 8, 11, 15, 17, 18, 20, 21]
import random
num_list = []
num=random.randint(0,100)
for i in range(100):
num_list.append(i)
def x(alist,quest):
low=0
high=len(alist)-1
......@@ -15,4 +19,4 @@ def x(alist,quest):
break
else:
low=mid+1
print(x(num_list,5))
\ No newline at end of file
print(x(num_list,num))
\ 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