port turtleportdom
2.设置画布大小和背景颜色
turtle.setup(800, 600)k’)
3.定义一个函数来画出樱花的花瓣
def petal()_fill()domdintdomdint(30, 50))
turtle.left(60)domdintdomdint(30, 50))d_fill()
4.定义一个函数来画出樱花的枝干
ch()size(10)’)
turtle.right(90)
turtle.forward(200)
turtle.left(180)size(5)’)
turtle.forward(20)
5.定义一个函数来画出樱花
()up()domdint(-350, 350)domdint(-250, 250)
turtle.goto(x, y)down()k’)
petal()
turtle.left(60)
petal()
turtle.left(60)
petal()
turtle.left(60)
petal()
turtle.left(60)
petal()
turtle.left(60)
petal()
turtle.left(60)ch()
6.使用循环来画出多个樱花
ge(10)()
e()来保持窗口打开状态
3画出美丽的樱花了。