Commit 3d817f1b by BellCodeEditor

save project

parent 4037d4dc
Showing with 19 additions and 2 deletions
import turtle
import random
pen = turtle.Turtle()
pen.color('sienna')
......@@ -6,10 +8,18 @@ pen.color('sienna')
w = turtle.Screen()
w.bgcolor('wheat')
# wheat小麦
def tree(n):
if n >= 50:
if n >= 0:
if n<=12
x = random.randint(1,2)
if x==1:
pen.color('snow')
else:
pen.color('lightcoral')
pen.pensize(n\3)
a = random.randint(0,30)
b = random.randint(0,15)
pen.forward(n)
pen.right(30)
tree(n-10)
......@@ -17,6 +27,13 @@ def tree(n):
pen.left(60)
tree(n-10)
pen.left(30)
pen.up
pen.backward(0)
pen.down
......
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