Commit 93742661 by BellCodeEditor

save project

parent 746c5319
Showing with 36 additions and 0 deletions
import turtle,random
t=turtle.Pen()
t.color("sienna")
sc=turtle.Screen()
sc.bgcolor("wheat")
t.setheading(90)
t.up()
t.backward(150)
t.down()
t.speed(0)
def tree(n):
if n>=0:
if n<=15:
c=random.choice(["snow","lightcoral"])
t.pencolor(c)
t.pensize(5)
else:
t.color("sienna")
t.pensize(n/10)
angle=random.randint(1,30)
length=random.randint(1,17)
t.forward(n)
t.right(angle)
tree(n-length)
t.left(angle*2)
tree(n-length)
t.right(angle)
t.up()
t.backward(n)
t.down()
tree(50)
turtle.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