Commit 161c267b by BellCodeEditor

save project

parent af95cacf
Showing with 20 additions and 2 deletions
num_list = [1, 3, 5, 8, 11, 15, 17, 18, 20, 21]
low=0
high=len(num_list)-1
fact_number=int(input('请问数字是什么???'))
while low <= high:
middle=(low+high)//2
#print(fact_number)
if num_list[middle]==fact_number:
print('找到啦!!!','它是',num_list[middle])
#print(middle)
exit()
elif num_list[middle] < fact_number:
low=middle+1
else:
high = middle-1
\ No newline at end of file
......@@ -23,7 +23,7 @@ def stick(londen):
pen.pensize(londen/10)
pen.pencolor('sienna')
angle=random.randint(1,30)
angle=random.randint(5,20)
lenth=random.randint(1,15)
pen.forward(londen)
pen.right(angle)
......@@ -43,5 +43,5 @@ def stick(londen):
# pen.down()
stick(70)
#turtle.tracer(False)
turtle.done()
\ 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