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

import turtle
#五角星
turtle.pencolor('yellow')
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()

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

import turtle turtle.pencolor('blue') turtle.fillcolor('green') turtle.begin_fill() while True: turtle.forward(100) turtle.right(56) if (abs(turtle.pos()))<1: break turtle.end_fill() turtle.done()


浙公网安备 33010602011771号