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()
運行結果: