五角星
1 import turtle 2 turtle.setup(600,550,200,200) 3 turtle.pensize(1) 4 turtle.fillcolor("red") 5 turtle.begin_fill() 6 for i in range(5): 7 turtle.fd(200) 8 turtle.left(216) 9 turtle.end_fill()
六边形
1 import turtle 2 turtle.setup(500,450,200,200) 3 turtle.pensize(1) 4 turtle.seth(30) 5 for i in range(3): 6 turtle.fd(90) 7 turtle.right(120) 8 turtle.fd(30) 9 turtle.left(60) 10 turtle.fd(30) 11 turtle.right(120) 12 for i in range(3): 13 turtle.fd(90) 14 turtle.right(120)
叠加等边三角形
1 #叠加等边三角形 2 import turtle 3 turtle.setup(600,500,200,200) 4 turtle.pensize(1) 5 for i in range(3): 6 turtle.fd(80) 7 turtle.left(120) 8 turtle.fd(40) 9 turtle.left(120) 10 turtle.fd(40) 11 for i in range (3): 12 turtle.right(120) 13 turtle.fd(40)