```
from turtle import *
from random import *
from math import *
def yezi(n,l):
right(90)
n=cos(radians(heading()-45))/4+0.5
pencolor(n,n*0.8,n*0.8)
circle(3)
left(90)
#添加0.3倍的飄落葉子
if(random()>0.7):
pu()
#飄落
t = heading()
an = -40 +random()*40
setheading(an)
dis = int(800*random()*0.5 + 400*random()*0.3 + 200*random()*0.2)
forward(dis)
setheading(t)
#畫葉子
pd()
right(90)
n = cos(radians(heading()-45))/4+0.5
pencolor(n*0.5+0.5,0.4+n*0.4,0.4+n*0.4)
circle(2)
left(90)
pu()
#返回
t=heading()
setheading(an)
backward(dis)
setheading(t)
yezi(n-1,l-1)
yezi(5,10)
```
```
from turtle import *
from random import *
from math import *
def yezi(n,l):
right(90)
n=cos(radians(heading()-45))/4+0.5
pencolor(n,n*0.8,n*0.8)
circle(30)
left(90)
#添加0.3倍的飄落葉子
if(random()>0.7):
pu()
#飄落
t = heading()
an = -40 +random()*40
setheading(an)
dis = int(800*random()*0.5 + 400*random()*0.3 + 200*random()*0.2)
forward(dis)
setheading(t)
#畫葉子
pd()
right(90)
n = cos(radians(heading()-45))/4+0.5
pencolor(n*0.5+0.5,0.4+n*0.4,0.4+n*0.4)
circle(20)
left(90)
pu()
#返回
t=heading()
#pd()
setheading(an)
backward(dis)
setheading(t)
pu()
backward(l)#退回
pd()
yezi(n-1,l-1)
yezi(2,20)
```
```
import turtle
from math import cos
a = turtle.heading()
print(a)
turtle.speed(1)
#turtle.mode('logo')
turtle.mode('world')
#turtle.setworldcoordinates(-500,-500,500,500)
#turtle.setworldcoordinates(-50,-7.5,50,7.5)
for i in range(4):
turtle.forward(100)
val = turtle.heading()
print(val)
n=cos(radians(val-45))
print(n)
turtle.write(str(val))
turtle.backward(100)
turtle.left(90)
```
```
right(90)
n=cos(radians(heading()-45))/4+0.5
pencolor(n,n*0.8,n*0.8)
circle(3)
left(90)
#添加0.3倍的飄落葉子
if(random()>0.7):
pu()
#飄落
t = heading()
an = -40 +random()*40
setheading(an)
dis = int(800*random()*0.5 + 400*random()*0.3 + 200*random()*0.2)
forward(dis)
setheading(t)
#畫葉子
pd()
right(90)
n = cos(radians(heading()-45))/4+0.5
pencolor(n*0.5+0.5,0.4+n*0.4,0.4+n*0.4)
circle(2)
left(90)
pu()
#返回
t=heading()
setheading(an)
backward(dis)
setheading(t)
```
- py轉exe
- py服務器
- py登錄
- py查詢
- 爬TB熱賣1017
- 爬TB分類1015
- 爬BD文庫1010
- 爬文庫924
- json917
- decode912
- 轉碼910
- radians829
- turtle827
- 畫葉子820
- 樹干815
- Turtle, mainloop718
- sorted716
- random711
- turtle.colormode709
- abs704
- begin_fill702
- randint,random627
- isalpha625
- keyword620
- compile618
- judge613
- list1.copy611
- random.choice606
- format_randint604
- save_csv528
- jieba523
- wordcloud521
- wordcloud516
- jieba.lcut514
- counts503
- format423
- 花瓣418
- strftime416
- turtle.fillcolor411
- random.random409
- pensize404
- 花蕊328
- input327
- eval_float320
- open319
- while314
- JCR影響因子313
- _to_chinese4_312
- encoding306
- read305
- flask1029