Python12-01_Practice:分形图形
作者:互联网
分形图形
1 import turtle 2 3 def a_line(len,n): 4 if n==0: 5 turtle.fd(len) 6 else: 7 for i in [0,60,-120,60]: 8 turtle.left(i) 9 a_line(len/3,n-1) 10 11 lenth = 500 12 level = 5 13 b = 120 14 def c(): 15 turtle.pensize(1) 16 turtle.pencolor('green') 17 turtle.speed(0) 18 turtle.penup() 19 turtle.goto(-300,200) 20 turtle.pendown() 21 22 a_line(lenth,level) 23 turtle.right(b) 24 a_line(lenth, level) 25 turtle.right(b) 26 a_line(lenth, level) 27 turtle.right(b) 28 29 turtle.hideturtle() 30 turtle.done() 31 32 c()
标签:turtle,01,Practice,level,Python12,len,right,lenth,line 来源: https://www.cnblogs.com/xujie-0528/p/13659990.html