Five-pointed star
import turtle as t#Give the turtle library an alias of t
t.forward(170)
#Draw a line according to the front angle t.right(36)
#The brush rotates to the right t.backward(170)#Draw a line according to the front angle
t .right(36)#Paint brush to rotate to the right
t.forward(170)
#Draw a line according to the front angle t.right(36)
#The brush rotate to the right t.backward(170)
#Draw a line according to the right angle t.right (36)
#Paint brush to rotate to the right t.forward(170)
#Draw a line according to the front angle t.fillcolor("yellow")
t.done()#Keep the window = turtle.done()
You can also use the for loop to draw a five-pointed star
import turtle as t#Give the turtle library a nickname of t
for i in range(5):
#Use a for loop to traverse t.forward(180)
#Draw a line according to the front angle t.right(144)#The brush rotates
t to the right .done()#Keep window = turtle.done()
Five-pointed star filled version
import turtle as t#Give the turtle library an alias of t
t.color("red","red")#
色t.begin_fill()#Start filling
for i in range(5):#Use a for loop to traverse
t.fd (200)#
forwardt.rt(144)#Turn to the right in angle units
t.hideturtle()#Let the brush disappear
t.end_fill()
t.done()#Keep the window = turtle.done()