Commit 4d9a6709 by BellCodeEditor

save project

parent ac9b9d4f
Showing with 10 additions and 6 deletions
......@@ -11,11 +11,17 @@ pen.left(90)
pen.up()
pen.backward(150) # 后退
pen.down()
color=["snow","lightcoral"]
def tree(n):
if n>=10:
long=random.randint(5,15)
jiao=random.randint(5,50)
if n>=0:
long=random.randint(1,20)
jiao=random.randint(1,30)
if n<=20:
pen.pensize(n/3)
pen.pencolor(random.choice(color))
else:
pen.pensize(n/10)
pen.pencolor("sienna")
pen.forward(n)
pen.right(jiao)
tree(n-long)
......@@ -26,6 +32,5 @@ def tree(n):
pen.forward(-n)
pen.pendown()
tree(100)
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