perfect flower design using python

 import turtle


# Set up the turtle

screen = turtle.Screen()

screen.bgcolor("white")

pen = turtle.Turtle()

pen.speed(10)


# Define flower colors

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


# Draw the flower

for _ in range(36):

    pen.color(colors[_ % len(colors)])

    pen.forward(100)

    pen.right(45)

    pen.forward(100)

    pen.right(135)

    pen.forward(100)

    pen.right(45)

    pen.forward(100)

    pen.right(135)


    # Rotate the turtle

    pen.right(10)


# Hide the turtle

pen.hideturtle()


# Exit on click

turtle.done()


Comments