write in python program using turtle make something cool
- User
write in python program using turtle make something cool
Assistant
Sure, here's a simple Python program that uses the turtle module to draw a spiral of stars. You can run it in your local machine or in an online Python compiler like repl.it.
import turtle # Set up the screen screen = turtle.Screen() screen.bgcolor("black") # Create a turtle to draw the spiral star_turtle = turtle.Turtle() star_turtle.speed(0) star_turtle.penup() # Set the starting position of the turtle star_turtle.goto(-200, -200) # Define a function to draw a single star def draw_star(turtle, size): for _ in range(5): turtle.forward(size) turtle.right(144) # Define a function to draw a spiral of stars def draw_spiral(turtle, size, spacing): for _ in range(100): # Draw a star at the current position turtle.pendown() draw_star(turtle, size) turtle.penup() # Move to the next position in the spiral turtle.forward(spacing) turtle.right(15) # Increase the size of the stars as we move outward size += 2 # Draw the spiral of stars draw_spiral(star_turtle, 5, 5) # Hide the turtle star_turtle.hideturtle() # Keep the window open turtle.done()
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.