一、程序
import turtle
def draw_triangle(side_length):
# 初始化turtle对象并设置速度
my_turtle = turtle.Turtle()
my_turtle.speed(1)
# 绘制三角形
for _ in range(3):
my_turtle.forward(side_length)
my_turtle.left(120)
# 结束后关闭窗口防止立即退出
turtle.done()
# 设定三角形边长,例如100像素
draw_triangle(66)