Commit 765cbc7a by BellCodeEditor

auto save

parent 619d3519
import random
a=[]
for i in range(1,101):
a.append(i)
num=random.choice(a)
def intermediate(self,zhao):
b=0
little=0
big=len(self)-1
while little<=big:
m=(little+big)//2
b=self[m]
if b==zhao:
return m
elif b>zhao:
big=m-1
elif b<zhao:
little=m+1
return None
g=intermediate(a,10)
print('找到了,索引是:'+str(g))
\ No newline at end of file
a=[94,91,90,88,87,83,81,80,79,77,76]
zhao=88
little=0
big=len(a)-1
while little<=big:
m=(little+big)//2
b=num_l[m]
if b==zhao:
print('找到了,索引是:'+str(m))
return m
elif b>zhao:
big=m-1
elif b<zhao:
little=m+1
else:
print('没找到,')成、
\ No newline at end of file
# 使用二分查找法,找出9和20在列表里面的索引 # 使用二分查找法,找出9和20在列表里面的索引
num_list = [1, 3, 5, 8, 11, 15, 17, 18, 20, 21] num_l = []
\ No newline at end of file zhao=20
little=0
big=len(num_l)-1
while little<=big:
m=(little+big)//2
b=num_l[m]
if b==zhao:
print('找到了,索引是:'+str(m))
return m
elif b>zhao:
big=m-1
elif b<zhao:
little=m+1
else:
print('没找到,ctmd')
\ No newline at end of file
import tkinter
root=tkinter.Tk()
root.title('注册')
root.geometry('400x600+575+120')
root.mainloop()
\ No newline at end of file
from turtle import*
from random import*
def tree(n):
if n>=0:
a=randint(10,30)
b=randint(0,30)
pensize(5)
fd(n)
right(a)
tree(n-b)
left(a*2)
tree(n-b)
right(a)
up()
backward(n)
down()
speed(100)
color('green')
up()
left(90)
backward(300)
down()
tree(100)
left(90)
fd(300)
right(90)
tree(70)
right(90)
fd(600)
left(90)
tree(70)
up()
fd(500)
right(90)
fd(80)
backward(40)
left(180)
fd(1000)
#hideturtle()
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