for循环:用turtle画一颗五角星

import turtle
turtle.bgcolor('red')
turtle.color('yellow')
turtle.fillcolor('yellow')
turtle.begin_fill()
for i in range(5):
    turtle.forward(100)
    turtle.right(144)
 

import turtle
turtle.forward(100)
turtle.right(144)

turtle.forward(100)
turtle.right(144)

turtle.forward(100)
turtle.right(144)

turtle.forward(100)
turtle.right(144)

turtle.forward(100)
turtle.right(144)
turtle.done()

import turtle
turtle.pencolor('purple')
turtle.fillcolor('pink')
turtle.begin_fill()
while True:
    turtle.forward(100)
    turtle.right(67)
    if abs(turtle.position())<5:
        break

turtle.end_fill()
turtle.done()

posted @ 2018-05-09 21:25  黄嘉欣  阅读(227)  评论(0)    收藏  举报