1.#Python的turtle绘制正六边形
代码:
len=100 #表示边长像素 import turtle as t #正六边形内角都是120度,外角60度 for i in range(6): t.left(60) t.fd(len) t.done()
结果:
2、#Python123 turtle叠边形绘制
Len=150 import turtle as t #叠边形内角为100度,外角就是80度 t.width(10) for i in range(10): t.fd(Len) t.left(80) t.done()
运行结果: