Prerequisite: Python Turtle Basics
Turtle is an inbuilt module of python. It enables us to draw any drawing by a turtle and methods defined in the turtle module and by using some logical loops. To draw something on the screen(cardboard) just move the turtle(pen).To move turtle(pen) there are some functions i.e forward(), backward(), etc
Approach to draw a Spiraling Star of size n:Â
- import turtle and create a turtle instance.
- Using for loop(i=0 to i<n) and repeat below step
- turtle.forward(i*10)
- turtle.right(144)
- close the turtle instance.
Â
Python3
# importing turtle moduleimport turtle  # number of sidesn = 10  # creating instance of turtlepen = turtle.Turtle()  # loop to draw a sidefor i in range(n):    # drawing side of     # length i*10    pen.forward(i * 10)      # changing direction of pen     # by 144 degree in clockwise    pen.right(144)  # closing the instanceturtle.done() |
Output:Â
Â
Â

… [Trackback]
[…] Read More Info here to that Topic: geeksforgeeks.org/draw-spiraling-star-using-turtle-in-python/ […]
… [Trackback]
[…] There you will find 71310 additional Info to that Topic: geeksforgeeks.org/draw-spiraling-star-using-turtle-in-python/ […]
… [Trackback]
[…] Here you will find 38716 more Info on that Topic: geeksforgeeks.org/draw-spiraling-star-using-turtle-in-python/ […]
… [Trackback]
[…] There you will find 70454 additional Info on that Topic: geeksforgeeks.org/draw-spiraling-star-using-turtle-in-python/ […]
… [Trackback]
[…] There you will find 83484 additional Information to that Topic: geeksforgeeks.org/draw-spiraling-star-using-turtle-in-python/ […]
… [Trackback]
[…] Information to that Topic: geeksforgeeks.org/draw-spiraling-star-using-turtle-in-python/ […]