python画六边形
图片
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/7dfe0ac3c94758945e28a4bfa5c4487d.png)
python代码
import turtle
import time
turtle.penup()
turtle.goto(-90,90)
turtle.pendown()
turtle.pensize(5)
turtle.pencolor("red")
for i in range(3):
turtle.fd(180)
turtle.right(120)
turtle.right(60)
turtle.fd(60)
turtle.right(60)
turtle.fd(60)
turtle.seth(60)
for i in range(3):
turtle.fd(180)
turtle.right((120))
turtle.done()
import turtle
turtle.penup()
turtle.goto(-90,90)
turtle.pendown()
turtle.pensize(5)
turtle.pencolor("red")
turtle.begin_fill()
turtle.fillcolor("yellow")
for i in range(3):
turtle.fd(180)
turtle.right(120)
turtle.right(60)
turtle.fd(60)
turtle.right(60)
turtle.fd(60)
turtle.seth(60)
for i in range(3):
turtle.fd(180)
turtle.right((120))
turtle.fd(60)
turtle.end_fill()
time.sleep(2)
turtle.penup()
turtle.goto(-150,-120)
turtle.color("violet")
turtle.write("peak", font=('Arial', 40, 'normal'))
turtle.done()