the Turtle module to draw a colorful spiral pattern on a black background.
You can use the Turtle module in Python to draw a colorful spiral pattern on a black background. Here's a simple example:
import turtle# Set up the screenscreen = turtle.Screen()screen.bgcolor("black")# Create a turtlet = turtle.Turtle()t.speed(0)# Set the fastest drawing speed# Define colors for the spiralcolors =['red','orange','yellow','green','blue','purple']# Draw the spiralfor i inrange(360): t.pencolor(colors[i % len(colors)]) t.width(i/100+1) t.forward(i) t.left(59)# Hide the turtlet.hideturtle()# Keep the window openturtle.done()
This code will draw a colorful spiral pattern on a black background using the Turtle module. Each loop iteration changes the pen color to one of the colors in the colors list, and the width of the pen increases as the loop progresses. The spiral is created by moving the turtle forward and turning it left at each step. Finally, we hide the turtle and keep the window open using turtle.done().