# Drawing a Spiralling Polygon using Turtle in Python

Python includes a module called Turtle. We can use the turtle module's methods and some logical loops to draw any graphic using a turtle. Simply move the turtle (pen) to draw anything on the screen (cardboard). There are other functions, such as forward() and reverse(), to move the turtle (pen).

## Creating a Spiral shape in Turtle :

Using the Python Turtle Module to draw spiral shapes is similar to learning anything else. Once you understand the fundamentals, you may apply them to any other shape. We 'll explain!

Spiral figures emerge from each cycle's reduction of the side's length by a specific number. The procedures for creating a spiral out of any shape are listed below.

• Select the side length of a figure and give it a changeable length. For instance, the length of a figure is 15 units.
• Use the forward() and right() methods of the turtle module while running a long for loop. The value of a figure's exterior angle should be supplied to the right() method, and the side variable should be supplied to the forward() The length of the side is then decreased by a particular amount.

We can make a spiral in a lot of shapes, so first we discuss a general polygon program followed by some of certain shaped polygon programs.

## Drawing a Spiralling Polygon using turtle in Python :

Steps to be followed for drawing a Spiralling polygon with a given side length are discussed ahead.

First of all, we will import the Turtle library to our program and rename it for our convenience.

Then, we will specify the speed of drawing using the speed() method.

Then, we will take input of the number of sides of the polygon and the length of each side of that polygon. This would then help us to calculate the exterior angle that is to be considered for drawing a Spiralling polygon.

Now, a for loop will be introduced to be executed 55 times, containing the forward() method to advance the turtle and right() method to turn the turtle right by a certain angle. Before the for loop ends, the value of length is updated to being 4 units lesser than the previous length.

Lastly, the hideturtle() method is used to hide the turtle on the completion of the execution of program.

### Complete code :

Output:

```Enter the total no. of sides for a polygon :  8
Enter the total length of a side for a polygon :  4
``` ## Drawing a Spiralling Square using turtle in Python :

Steps to be followed for drawing a Spiralling square with a given side length are discussed ahead.

First of all, we will import the Turtle library to our program and rename it for our convenience.

Then, we will mention the size of the pen (turtle) using the pensize() method along with specifying the speed of the drawing using the speed() method.

Then, we will provide the length of the side that is to be considered for drawing a Spiralling square.

Now, a for loop will be introduced to be executed 90 times, containing the forward() method to advance the turtle and right() method to turn the turtle right by a certain angle. Before the for loop ends, the value of length is updated to being 2 units lesser than the previous length.

Lastly, the hideturtle() method is used to hide the turtle on the completion of the execution of program.

### Complete Code :

Output: ## Drawing a Spiralling star using turtle in Python :

Steps to be followed for drawing a Spiralling star with a given side length are discussed ahead.

First of all, we will import the Turtle library to our program and rename it for our convenience.

Then, we will specify the speed of drawing using the speed() method.

Then, we will provide the length of the side that is to be considered for drawing a Spiralling star.

Now, a for loop will be introduced to be executed 60 times, containing the forward() method to advance the turtle and right() method to turn the turtle right by a certain angle. Before the for loop ends, the value of length is updated to being 4 units lesser than the previous length.

Lastly, the hideturtle() method is used to hide the turtle on the completion of the execution of program.

### Complete code :

Output: ## Drawing a Spiralling triangle using turtle in Python :

Steps to be followed for drawing a Spiralling triangle with a given side length are discussed ahead.

First of all, we will import the Turtle library to our program and rename it for our convenience.

Then, we will specify the speed of drawing using the speed() method.

Then, we will provide the length of the side that is to be considered for drawing a Spiralling triangle.

Now, a for loop will be introduced to be executed 60 times, containing the forward() method to advance the turtle and right() method to turn the turtle right by a certain angle. Before the for loop ends, the value of length is updated to being 4 units lesser than the previous length.

Lastly, the hideturtle() method is used to hide the turtle on the completion of the execution of program.

### Complete code :

Output: ## Drawing a Spiraling pentagon using turtle in Python :

Steps to be followed for drawing a Spiraling pentagon with a given side length are discussed ahead.

First of all, we will import the Turtle library to our program and rename it for our convenience.

Then, we will specify the speed of drawing using the speed() method.

Then, we will provide the length of the side that is to be considered for drawing a Spiralling pentagon.

Now, a for loop will be introduced to be executed 55 times, containing the forward() method to advance the turtle and right() method to turn the turtle right by a certain angle. Before the for loop ends, the value of length is updated to being 4 units lesser than the previous length.

Lastly, the hideturtle() method is used to hide the turtle on the completion of the execution of program.

### Complete code :

Output: ## Drawing a Spiralling hexagon using turtle in Python :

Steps to be followed for drawing a Spiralling hexagon with a given side length are discussed ahead.

First of all, we will import the Turtle library to our program and rename it for our convenience.

Then, we will specify the speed of drawing using the speed() method.

Then, we will provide the length of the side that is to be considered for drawing a Spiralling pentagon.

Now, a for loop will be introduced to be executed 48 times, containing the forward() method to advance the turtle and right() method to turn the turtle right by a certain angle. Before the for loop ends, the value of length is updated to being 4 units lesser than the previous length.

Lastly, the hideturtle() method is used to hide the turtle on the completion of the execution of program.

### Complete code :

Output: ## Help Others, Please Share   