turtle 多角形描画
import turtle as t def takakkei(n,w): p=t.Pen() p.reset() p.up() p.goto(-25,-120) p.down() c=('red','green','pink','aqua','blue') deg=360//n for x in range(1,n+1): z=x%5 p.color(c[z]) p.forward(w) p.left(deg) t.setup(width=300,height=300) t.bgcolor("white") for i in range(3,16): takakkei(i,50) 実行結果 >>> === RESTART: C:/python/turtleDrawTakakkei.py === >>>