Skip to content

Instantly share code, notes, and snippets.

@stephengruppetta
Created December 18, 2023 10:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stephengruppetta/3d147b5bd20550a38d3e2a691774e264 to your computer and use it in GitHub Desktop.
Save stephengruppetta/3d147b5bd20550a38d3e2a691774e264 to your computer and use it in GitHub Desktop.
# Traditional route…
import turtle
import random
# ...
cute_turtles = []
for idx in range(n_turtles):
# Create a 'Turtle' instance
cute_turtle = turtle.Turtle()
# Set up the turtles initial state
cute_turtle.left(idx * (360 / n_turtles))
cute_turtle.color(random.random(), random.random(), random.random())
cute_turtle.penup()
cute_turtle.shape("turtle")
# Add the 'Turtle' object to the list 'cute_turtles'
cute_turtles.append(cute_turtle)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment