https://kg.qq.com/node/play?s=-P02hh-IeLNWp-gyimport turtle
turtle.speed(100)
def ke_line(line_, n):
if n == 0:
turtle.fd(line_)
else:
line_len = line_ // 3
for i in [0, 60, -120, 60]:
turtle.left(i)
ke_line(line_len, n - 1)
# 原始线长度
line = 300
# 移动小海龟画布左下角
turtle.penup()
turtle.goto(-150, -150)
turtle.pendown()
# 几阶科赫雪花
di_gui_deep = int(input("请输入科赫雪花的阶数:"))
while True:
# 当多少科赫雪花围绕成一个圆周时,就构成一个完整的雪花造型
count = int(input("需要几个科赫雪花:"))
if 360 % count != 0:
print("请输入 360 的倍数")
else:
break
for i in range(count):
ke_line(line, di_gui_deep)
turtle.left(360 // count)
turtle.done()
--
FROM 111.52.6.*