My sister wanted to go to Japan to see cherry blossoms, to see the epidemic situation, to see the air ticket, instantly I persuaded her to leave, but to coax her happy, so I used Python to draw her a cherry blossom map, reluctantly coax her, clamoring to learn Python with me, this…

I certainly won’t agree, unexpectedly want to rob rice bowl with me, the most important again is not the little brother, let me teach, this is not too good ^_^

Then want me to introduce programmer to her little brother, this fat water does not flow outside the field ah, I am sure to keep their own appreciation, how can share it out! No, no, no

Next, please enjoy my painting of cherry blossoms

Tools used: Pycharm, turtle

Effect display:

Share all source code, upgradable and modifiable:

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: 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('pink') 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='skyblue') t.left(90) t.up() t.backward(150) t.down() t.color('sienna') Tree(60, t) Petal(200, t) w.exitonclick()Copy the code

I am ** white and white I **, a program yuan like to share knowledge ❤️

If you don’t know how to program or want to learn how to program, you can leave a message on this blog. Thank you very much for your likes, favorites, comments, one-click support.