0

I have tried to do a for loop to achieve a variable number of turtle clones but it doesn't create variables it only changes them. This is what I have tried but it doesn't create 20 clones with their name being a number from 1-20. The only reason that I want to do this is so I can easily create several turtles with easily accessible names:

import turtle
from turtle import *
turtle = Turtle()
for idx in range(20):
  idx = turtle.clone()
for turtle in turtles():
  print(turtle)
quamrana
  • 37,849
  • 12
  • 53
  • 71
  • 1
    An Array structure, perhaps? Can't give you much actionable advice without seeing the code you're trying to run and getting stuck on. [ask] – esqew Oct 01 '21 at 16:05
  • 2
    Please update your question with the code you have tried. – quamrana Oct 01 '21 at 16:06
  • You might wanna look at basic data structures in Python. @COLE – Vishnudev Krishnadas Oct 01 '21 at 16:07
  • I see you have improved your question, but you should look up the linked question. This will show you a number of ways to achieve what you want. You could start with this: `turtles = [Turtle() for _ in range(20)]` – quamrana Oct 01 '21 at 16:29
  • I tried doing the: `turtles = [Turtle() for _ in range(20)]` and I get the error that says that "turtles" is a list and I need clones if that makes sense. – COLE FRANZ Oct 04 '21 at 12:46

0 Answers0