Commit 271f5198 by BellCodeEditor

save project

parent acb59233
Showing with 19 additions and 1 deletions
import random
alist = {}
for i in range(1,101):
alist.append(i)
num = random.choice(alist)
def = binary_search(alist)
low = 0
high = len(num_list)-1
while low <= high:
mid = (low+high) // 2
guess_num = num_list[mid]
if guess_num == bingo_num:
print(s_num < bingo_num:
low = mid + 1
elif guess_num > bingo_num:
low = mid - 1"找到了,它在列表里的索引是: " , mid)
break
elif gues
\ 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