使用turtle库绘制六角形
作者:互联网
六角形的绘制
描述
使用turtle库绘制一个六角形,效果如下:
图中线条颜色、宽度、填充、箭头位置和风格不限。
输入
无
输出
如上图
代码如下:
import turtle
turtle.left(30)
turtle.forward(144)
turtle.right(60)
turtle.forward(144)
turtle.right(60)
turtle.forward(144)
turtle.right(60)
turtle.forward(144)
turtle.right(60)
turtle.forward(144)
turtle.right(60)
turtle.forward(144)
turtle.forward(144)
turtle.right(120)
turtle.forward(144)
turtle.left(60)
turtle.forward(144)
turtle.right(120)
turtle.forward(144)
turtle.left(60)
turtle.forward(144)
turtle.right(120)
turtle.forward(144)
turtle.left(60)
turtle.forward(144)
turtle.right(120)
turtle.forward(144)
turtle.left(60)
turtle.forward(144)
turtle.right(120)
turtle.forward(144)
turtle.left(60)
turtle.forward(144)
turtle.right(120)
turtle.forward(144)
标签:turtle,120,144,right,60,forward,绘制,六角形 来源: https://www.cnblogs.com/slj-xt/p/12458570.html