# Turtle – create a colorful and intricate geometric pattern

Here’s an code example using the Turtle library to create a colorful and intricate geometric pattern.

``````import turtle

# Set up the screen
screen = turtle.Screen()
screen.bgcolor("black")
screen.title("Turtle Geometric Pattern")

# Create a turtle
t = turtle.Turtle()
t.speed(0)  # Set the fastest drawing speed

# Function to draw a colorful geometric pattern
def draw_pattern():
colors = ["red", "orange", "yellow", "green", "blue", "purple"]
for i in range(360):
t.pencolor(colors[i % 6])
t.width(i/100 + 1)
t.forward(i)
t.left(59)

# Draw the pattern
t.penup()
t.goto(-100, -100)
t.pendown()
draw_pattern()

# Hide the turtle
t.hideturtle()

# Keep the window open until closed by the user
turtle.done()``````
##### Code Explanation
1. We import the Turtle library and set up the screen with a black background and a title.
2. We create a Turtle object `t` and set its drawing speed to the fastest possible (`0`).
3. We define a function `draw_pattern()` to draw a colorful geometric pattern using a loop.
4. Inside the loop, we change the pen color and width based on the current iteration, then move the turtle forward and turn it left.
5. After defining the function, we position the turtle and start drawing the pattern.
6. Once the pattern is drawn, we hide the turtle and keep the window open until closed by the user.
##### Output

The output of the above code example is a window displaying a colorful and intricate geometric pattern drawn using the Turtle library. The pattern consists of multiple overlapping shapes with varying colors and line widths, creating a visually appealing design. The turtle cursor moves across the screen, drawing the pattern as specified in the code.