## python绘制科赫雪花
脚本如下:
import turtle
def koch(size,n):
if n==1:
turtle.fd(size)
else:
for i in [0,60,-120,60]:
turtle.left(i)
koch(size/3,n-1)
def main():
turtle.setup(600,600)
turtle.penup()
turtle.speed(10)
turtle.hideturtle()
turtle.pensize(2)
turtle.goto(-200,100)
turtle.pendown()
level=4
koch(400,level)
turtle.right(120)
koch(400, level)
turtle.right(120)
koch(400, level)
turtle.penup()
turtle.done()
main()
演示结果如图: