CIRCLE PATTERN USING PYTHON

      import turtle


def draw_circle(radius):

    turtle.circle(radius)


def draw_circle_pattern(num_circles, radius):

    angle = 360 / num_circles

    for _ in range(num_circles):

        draw_circle(radius)

        turtle.right(angle)


# Set up turtle

turtle.speed(0)  # Set the speed of drawing (0 is the fastest)

turtle.pensize(2)  # Set the thickness of the pen

turtle.bgcolor("black")  # Set the background color


# Set the colors for the circle pattern

colors = ["red", "green", "blue", "yellow"]


# Draw the circle pattern

for i in range(20):

    turtle.color(colors[i % len(colors)])

    draw_circle_pattern(4, 100)

    turtle.right(10)


# Hide the turtle cursor when finished drawing

turtle.hideturtle()


# Keep the window open

turtle.done()

Comments