Commit 1c221fb8 by BellCodeEditor

auto save

parent 32b0e99b
Showing with 24 additions and 10 deletions
import turtle
import random
def tree(n):
if n>=0:
if n < =12:
color_list = ["soow","lightcoral"]
color = random.choice(color_list)
pen.color(color)
pen.forward(n)
pen.right(30)
tree(n-10)
pen.left(60)
tree(n-10)
pen.right(30)
pen.up
pen.backward(n)
pen.down()
pen = turtle.Turtle()
pen.color('sienna')
......@@ -12,13 +31,7 @@ pen.up()
pen.backward(150) # 后退
pen.down()
pen.forward(100)
pen.left(30)
pen.forward(50)
pen.backward(50)
pen.right(60)
pen.forward(50)
pen.backward(50)
pen.left(30)
pen.backward(100)
turtle.done()
tree(60)
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