1、正方形
import turtle
t=turtle.Turtle()
for i in range(4):
t.forward(100)
t.left(360/4)
2俐芯、五邊形
import turtle
t=turtle.Turtle()
for i in range(5):
t.forward(100)
t.left(360/5)
3棵介、邊框顏色
import turtle
t=turtle.Turtle()
t.color("red")
for i in range(5):
t.forward(100)
t.left(360/5)
4、填充顏色
import turtle
t=turtle.Turtle()
t.color("red","yellow")
t.begin_fill()
for i in range(5):
t.forward(100)
t.left(360/5)
t.end_fill()
5吧史、五角星
import turtle
t=turtle.Turtle()
t.color("red","yellow")
t.begin_fill()
for i in range(5):
t.forward(100)
t.right(144)
t.end_fill()
6邮辽、正方形圈
import turtle
t=turtle.Turtle()
t.speed(10)
for j in range(10):
for i in range(4):
t.down()
t.forward(10+j*20)
t.left(90)
t.up()
t.goto(-10*(j+1),-10*(j+1))
7、同心圓
import turtle
t=turtle.Turtle()
t.speed(10)
for i in range(5,0,-1):
t.up()
t.goto(0,-30*i)
t.down()
t.circle(30*i)
8贸营、填充顏色同心圓
import turtle
t=turtle.Turtle()
t.speed(10)
colors=["red","blue","yellow","purple","green"]
for i in range(5,0,-1):
t.up()
t.goto(0,-30*i)
t.color(colors[i%5])
t.begin_fill()
t.down()
t.circle(30*i)
t.end_fill()