到处画五角星

0
import random
import turtle

screen=turtle.getscreen()
screen.setup(800,600)

turtle.pensize(5)
turtle.speed(7)
turtle.penup()
turtle.fillcolor('yellow')

for c in range(5):
    x=random.randint(-400,250)
    y=random.randint(-150,150)
    d=random.randint(10,150)
    turtle.goto(x,y)
    turtle.begin_fill()
    turtle.pendown()
    for e in range(5):
        turtle.fd(d)
        turtle.rt(144)
    turtle.penup()
    turtle.end_fill()

0

发表评论