for循环:用turtle画一颗五角

import turtle
turtle.pencolor('blue')
turtle.fillcolor('red')
turtle.begin_fill()

while True:
    turtle.forward(100)
    turtle.right(50)
    if abs(turtle.position())<1:
        break

turtle.end_fill()
turtle.done()

  

import turtle
turtle.bgcolor('red')
turtle.pencolor('yellow')
turtle.fillcolor('yellow')
turtle.begin_fill()
turtle.forward(300)
turtle.right(144)

turtle.forward(300)
turtle.right(144)

turtle.forward(300)
turtle.right(144)

turtle.forward(300)
turtle.right(144)

turtle.forward(300)
turtle.right(144)

turtle.end_fill()
turtle.done()

猜你喜欢

转载自www.cnblogs.com/AN23/p/9016710.html