Commit 2c40cd48 by BellCodeEditor

auto save

parent 6f6a737d
Showing with 25 additions and 7 deletions
num_list=[1,3,5,8,11,15,17,18,20,21]
mid=(low+high)//2
guess=num_list[mid]
if guess==17:
print("zhao")
\ No newline at end of file
import turtle
import random
pen = turtle.Turtle()
colors=['snow','lightcoral']
pen.color('sienna')
# 画布大小
w = turtle.Screen()
......@@ -11,17 +12,27 @@ pen.penup()
pen.backward(150)
pen.down()
def tree(n):
if n>=50:
if n>=0:
if n<=12:
color=random.choice(colors)
pen.pencolor(color)
pen.pensize(n/2)
else:
pen.pensize(n/10)
pen.pencolor('sienna')
pen.forward(n)
pen.right(30)
tree(n-10)
pen.left(60)
tree(n-10)
pen.right(30)
a=random.randint(0,30)
l=random.randint(1,15)
pen.right(a)
tree(n-l)
pen.left(2*a)
tree(n-l)
pen.right(a)
pen.up()
pen.backward(n)
pen.down()
tree(100)
tree(70)
# 移动到起点
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