In this program, we will generate a circular pattern out of squares using python's turtle module.
In this program,we will generate a circular pattern out of squares using python's Turtle module.
For drawing the circle,we need to draw n number of square,each time rotating the turtle cursor by d degrees. n and d are chosen such that,
n*d=360.
so by this way we can complete a full circle.
Now to draw a circle using turtle, we will use a predefined function in "turtle".circle(radius):This function draws a circle of the given radius by taking the
This funtion always draws a circle of the given radius by taking the "turtle" position as the cente
import turtle x=turtle.Turtle() def square(angle): x.forward(100) x.right(angle) x.forward(100) x.right(angle) x.forward(100) x.right(angle) x.forward(100) x.right(angle+10) for i in range(36): square(90)
Submitted by Karthik Nagisetty (karthik)
Download packets of source code on Coders Packet
Comments