方法一>>函数封装绘制菱形:

import turtle as t
def draw():
t.hideturtle()
angles=[0,30,60,90,120,150,180,210,240,270,300,330,360]
l=60*(3**0.5)
colors=["yellow"]
t.begin_fill()
t.fillcolor(colors[0])
t.seth(angles[i])
t.forward(180)
t.right(30)
t.forward(l)
t.left(60)
t.forward(l)
t.left(120)
t.forward(l)
t.left(60)
t.forward(l)
t.goto(0,0)
t.end_fill()
def draw_circle():
t.hideturtle()
l=180
t.seth(90)
t.forward(180)
t.right(90)
t.color("red")
t.circle(-l,360)
for i in range(12):
draw()
draw_circle()
t.exitonclick() #turtle执行完后保留那个页面

方法二:
import turtle as t
def draw():
t.hideturtle()
angles=[0,30,60,90,120,150,180,210,240,270,300,330,360]
l=60*(3**0.5)
t.color("black")
colors=["yellow"]
t.begin_fill()
t.fillcolor(colors[0])
t.seth(angles[i])
t.right(30)
t.forward(l)
t.left(60)
t.forward(l)
t.left(120)
t.forward(l)
t.left(60)
t.forward(l)
t.end_fill()
def draw_circle():
t.hideturtle()
l=180
angles = [0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360]
t.seth(angles[i])
t.color("red")
t.left(90)
t.circle(l,30)
t.goto(180,0)
t.clear()
for i in range(12):
draw()
draw_circle()
t.exitonclick() #turtle执行完后保留那个页面
