五角星

①
import turtle turtle.pensize(1) turtle.fillcolor("red") turtle.begin_fill() for i in range(5): turtle.fd(200) turtle.right(144) turtle.end_fill()
②
from turtle import * fillcolor("red") begin_fill() while True: forward(200) right(144) if abs(pos())<1: break end_fill()

③
from turtle import * color("yellow","red") pensize(10) begin_fill()#和end_fill成对出现,填充起点和终点 while True: forward(200) right(144) if abs(pos())<1:#获取位置的绝对值 break end_fill()

浙公网安备 33010602011771号