import turtle //导入python绘图库turtle
painter = turtle.Turtle() //画笔
painter.pencolor(“blue”) //画笔颜色
for i in range(50):
painter.forward(50) //画笔向前移动
painter.left(123) //画笔向左移动
painter.pencolor(“red”) //更改画笔颜色
for i in range(50):
painter.forward(100)
painter.left(123)
turtle.done()
效果如下:
一个很有美感的图形