条件、循环
画五角星
import turtle
turtle.color('yellow')
turtle.bgcolor('red')
turtle.fillcolor('yellow')
turtle.up()
turtle.goto(-230,130)
turtle.down()
turtle.begin_fill()
for i in range(5):
turtle.forward(100)
turtle.right(144)
turtle.end_fill()

画同心圆
import turtle
for i in range(5):
turtle.up()
turtle.goto(0,-20*(i+1))
turtle.down()
turtle.circle(20*(i+1))

画太阳花
import turtle
turtle.color('yellow','blue')
turtle.begin_fill()
while True:
turtle.forward(200)
turtle.left(170)
if(abs(turtle.pos()))<1:
break
turtle.end_fill()
done

画五个角星
import turtle
turtle.color('yellow')
turtle.bgcolor('red')
turtle.fillcolor('yellow')
def wugoto(x,y):
turtle.up()
turtle.goto(x,y)
turtle.down()
wugoto(-230,130)
turtle.begin_fill()
for i in range(5):
turtle.forward(100)
turtle.right(144)
turtle.end_fill()
wugoto(-110,200)
turtle.begin_fill()
for i in range(5):
turtle.forward(40)
turtle.left(144)
turtle.end_fill()
wugoto(-75,150)
turtle.begin_fill()
for i in range(5):
turtle.forward(40)
turtle.left(144)
turtle.end_fill()
wugoto(-65,90)
turtle.begin_fill()
for i in range(5):
turtle.forward(40)
turtle.left(144)
turtle.end_fill()
wugoto(-90,30)
turtle.begin_fill()
for i in range(5):
turtle.forward(40)
turtle.left(144)
turtle.end_fill()

浙公网安备 33010602011771号