Python基础综合练习

import turtle
turtle.setup(600, 400, 10, 10)
turtle.bgcolor('red')
turtle.hideturtle()
turtle.speed(10)
turtle.pencolor('yellow')

def draw(chang):
    turtle.fillcolor('yellow')
    turtle.begin_fill()
    for i in range(5):
        turtle.forward(chang)
        turtle.right(144)
    turtle.end_fill()

def gotopen(x,y):
    turtle.penup()
    turtle.goto(x,y)
    turtle.pendown()

gotopen(-250,110)
draw(110)

gotopen(-100,160)
turtle.right(-15)
draw(40)

gotopen(-60,120)
turtle.right(0)
draw(40)

gotopen(-60,80)
turtle.right(15)
draw(40)

gotopen(-100,40)
turtle.right(30)
draw(40)

turtle.done()

  

原文地址:https://www.cnblogs.com/hano/p/8600234.html