Py学习Day1:turtle函数-正方形

画正方形

import turtle
turtle.width(5)
turtle.color("purple")

turtle.forward(60)
turtle.left(90)
turtle.forward(60)
turtle.left(90)
turtle.forward(60)
turtle.left(90)
turtle.forward(60)
turtle.left(90)
turtle.penup()

turtle.color("pink")
turtle.goto(-120,0)
turtle.pendown()
turtle.forward(60)
turtle.left(90)
turtle.forward(60)
turtle.left(90)
turtle.forward(60)
turtle.left(90)
turtle.forward(60)
turtle.penup()

turtle.color("grey")
turtle.goto(-120,-120)
turtle.pendown()
turtle.forward(60)
turtle.left(90)
turtle.forward(60)
turtle.left(90)
turtle.forward(60)
turtle.left(90)
turtle.forward(60)
turtle.penup()

turtle.color("green")
turtle.goto(60,-120)
turtle.pendown()
turtle.forward(60)
turtle.left(90)
turtle.forward(60)
turtle.left(90)
turtle.forward(60)
turtle.left(90)
turtle.forward(60)

结果:

Py学习Day1:turtle函数-正方形_第1张图片

你可能感兴趣的:(学习)