The turtle is built in library so we don’t need to install separately. We just need to import the library into our Python environment. The Python turtle library consists of all important methods and functions that we will need to create our designs and images. Import the turtle library using the following command.
How To Install Turtle:
pip install turtle
pip3 install turtle
turtle is a pre-installed Python library that enables users to create pictures and shapes by providing them with a virtual canvas. The onscreen pen that you use for drawing is called the turtle and this is what gives the library its name.
import turtle t = turtle.Turtle() s = turtle.Screen() colors = ['red', 'purple', 'blue' , 'green', 'orange', 'yellow'] s.bgcolor('black') t.speed('fastest') t.hideturtle() for x in range(200): t.pencolor(colors[x % len(colors)]) t.width(x/100 + 1) t.forward(x) t.left(59) t.right(239) turtle.done()