用turtle海龟库画五角星
1.简单的五角星
import turtle as t #引入海龟库 for x in range(5): t.forward(100) #画一条直线 t.right(144) #海龟向右旋转144度
import turtle as t def wjx(j): t.speed(0) t.hideturtle() t.pencolor("black") t.fillcolor("yellow") t.begin_fill() for x in range(j): t.forward(50) t.right(360/j) t.forward(50) t.left(360/j*2) t.end_fill() wjx(5)