What is Turtle in Python
Turtle is like a drawing board in Python, which lets us command a turtle to draw over where we have insisted the direction like forward(), backward(), etc.
How to use Turtle
1. We need to import the "Turtle" package
2. We have to create a turtle where we need to control
3. Give direction to draw around using the turtle methods
4. Finally, run turtle.done()
Note:
You can install these libraries using pip command.
import the required package to draw the logo.
Turtle is pre-installed in mostly all programming software if Turtle is not installed please use this pip command pip install PythonTurtle
Source code:
from turtle import *
speed(10)
color("#0270d6")
Screen().bgcolor('grey')
penup()
goto(0, 150)
pendown()
begin_fill()
forward(150)
circle(-50, 90)
forward(300)
circle(-50, 90)
forward(300)
circle(-50, 90)
forward(300)
circle(-50, 90)
forward(150)
end_fill()
color("white")
penup()
goto(140, 80)
pendown()
begin_fill()
right(180)
forward(50)
circle(80, 90)
forward(50)
right(90)
forward(80)
left(90)
forward(40)
left(90)
forward(80)
right(90)
forward(160)
left(90)
forward(55)
left(90)
forward(160)
right(90)
forward(70)
left(80)
forward(45)
left(100)
forward(80)
right(90)
forward(40)
circle(-40, 90)
forward(40)
left(90)
forward(45)
end_fill()
hideturtle()
done() (code-box)
output:
Visual studio code