程序员是真浪漫(学习别人的)
1、
import turtle as T
import random
import time
def Tree(branch, t):
time.sleep(0.0005)
if branch > 3:
if 8 <= branch <= 12:
if random.randint(0, 2) == 0:
t.color(‘snow’) # 白
else:
t.color(‘lightcoral’) # 淡珊瑚色
t.pensize(branch / 3)
elif branch < 8:
if random.randint(0, 1) == 0:
t.color(‘snow’)
else:
t.color(‘lightcoral’) # 淡珊瑚色
t.pensize(branch / 2)
else:
t.color(‘sienna’) # 赭(zhě)色
t.pensize(branch / 10) # 6
t.forward(branch)
a = 1.5 * random.random()
t.right(20 * a)
b = 1.5 * random.random()
Tree(branch - 10 * b, t)
t.left(40 * a)
Tree(branch - 10 * b, t)
t.right(20 * a)
t.up()
t.backward(branch)
t.down()
def Petal(m, t):
for i in range(m):
a = 200 - 400 * random.random()
b = 10 - 20 * random.random()
t.up()
t.forward(b)
t.left(90)
t.forward(a)
t.down()
t.color(‘lightcoral’) # 淡珊瑚色
t.circle(1)
t.up()
t.backward(a)
t.right(90)
t.backward(b)
t = T.Turtle()
w = T.Screen()
t.hideturtle() # 隐藏画笔
t.getscreen().tracer(5, 0)
w.screensize(bg=‘wheat’) # wheat小麦
t.left(90)
t.up()
t.backward(150)
t.down()
t.color(‘sienna’)
Tree(60, t)
Petal(200, t)
w.exitonclick()
2、
相关知识
Python机器学习基础教程
科学网—为什么生态学家要学习Python或者R?
《Python机器学习开发实战》电子书在线阅读
python学习笔记(十六)文件操作
[Python机器学习]鸢尾花分类 机器学习应用
【Python】基础
基于python编程的五种鲜花识别
SKYNE/python
基于YOLOv8深度学习的102种花卉智能识别系统【python源码+Pyqt5界面+数据集+训练代码】目标识别、深度学习实战
python 花卉识别系统 用python搭建一个花卉识别系统(IT技术)
网址: Python学习 https://m.huajiangbk.com/newsview140447.html
上一篇: 广州市城市植被景观多样性分析 |
下一篇: 2020城市植被类型及功能(27 |