如何用Python画雪花,可以自行调节显示大小
import turtle
def koch(size,n):
if n==0:
turtle.fd(size)
else:
for angle in[0,60,-120,60]:turtle.left(angle)koch(size/3,n-1)turtle.speed(100)
def main():
turtle.setup(800,400)
turtle.penup()
turtle.goto(-200,50)
turtle.pendown()
turtle.pensize(4)
koch(3000,5)
turtle.hideturtle()
main()
转载至书本