Commit f8bc44f8 by BellCodeEditor

auto save

parent d8dfc649
Showing with 2 additions and 37 deletions
import turtle a = open(r"C:\Users\86132\Desktop\新建文件夹\text.txt","w",encoding="utf-8")
import random \ No newline at end of file
p = turtle.Pen()
p.color('sienna')
turtle.Screen().bgcolor('wheat')
p.penup()
p.sety(-150)
p.left(90)
p.pensize(5)
p.hideturtle()
p.speed(11)
p.pendown()
def tree(size):
if size >= 0:
if size >= 15:
p.pencolor('sienna')
p.pensize(size/10)
else:
p.pensize(size/3)
colors = ['snow','lightcoral']
color = colors[random.randint(0,1)]
p.pencolor(color)
length = random.randint(5,20)
angle = random.randint(5,30)
p.forward(size)
p.left(angle)
tree(size-length)
p.right(angle*2)
tree(size-length)
p.left(angle)
p.penup()
p.backward(size)
p.pendown()
tree(80)
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