Commit 4385171e by BellCodeEditor

auto save

parent 576b5884
Showing with 35 additions and 0 deletions
import turtle
import random
s = turtle.Screen()
s.bgcolor('wheat')
p = turtle.Pen()
p.speed(0)
p.up()
p.left(90)
p.backward(100)
p.down()
def tree(n):
if n >= 0:
angle = random.randint(15,30)
lenth = random.randint(5,10)
pencolor = ['snow','lightcoral']
tree_lenth = n - lenth
if tree_lenth < 5:
p.color(random.choice(pencolor))
p.pensize(5)
else:
p.pensize(n/10)
p.color('sienna')
p.forward(n)
p.right(angle)
tree(tree_lenth)
p.left(2*angle)
tree(tree_lenth)
p.right(angle)
p.up()
p.backward(n)
p.down()
tree(60)
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