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



import turtle

turtle.setup(600,400,0,0)

turtle.bgcolor('black')
turtle.pencolor('yellow')
turtle.fillcolor('yellow')
turtle.begin_fill()


turtle.penup()
import turtle

turtle.bgcolor('black')
turtle.pencolor('yellow')


while True:
    turtle.forward(66)    
    turtle.right(133)
    if abs(turtle.position())<1:
        break
turtle.end_fill()
turtle.done()

 


turtle.goto(-250,0)
turtle.pendown()
for i in range(5):
    turtle.forward(100)    
    turtle.right(144)
turtle.end_fill()
turtle.done

 

 

 

import turtle

turtle.fillcolor('yellow')
turtle.begin_fill()
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.end_fill()
turtle.done

 

posted @ 2018-05-09 20:38  赵敏婷  阅读(200)  评论(0)    收藏  举报