Home >Backend Development >Python Tutorial >python drawing four leaf clover
This article introduces how to draw a four-leaf clover in python using the turtle library. The code is very simple. I hope it will be helpful to friends who are learning python.
python drawing four-leaf clover
import turtle def draw_shapes(): window = turtle.Screen() window.bgcolor("red") flower = turtle.Turtle() flower.speed(10) flower.shape("arrow") flower.right(45) for i in range(1,37): for j in range(1,5): draw_circle(flower,i,"green") flower.left(90) flower.right(45) flower.color("green") flower.forward(500) window.exitonclick() def draw_circle(circle,radius,color): circle.color(color) circle.circle(radius) draw_shapes()
Rendering:
Many python training videos, all on the python learning network, welcome to learn online!
The above is the detailed content of python drawing four leaf clover. For more information, please follow other related articles on the PHP Chinese website!