title: How can you put 20 turtles on a circle in Python?
body: <p>I have to put 20 turtles on verticles of a polygon with 20 sides, so they will be on a circle with regular spacing.</p>
  
  <p>I have class Turtle, where I want to put those 20 turtles. I know how to put more turtles in one file, but how can I situate them in a circle?</p>
  
  <pre><code># Already working
  class Turtle:
  
      def __init__(self, x, y):
          self.x = x
          self.y = y
          self.heading = 0
          self.lines = []
  
      def left(self, angle):
          self.heading -= angle
  
      def right(self, angle):
          self.heading += angle
  
      def forward(self, d):
          nx = self.x + d * math.cos(self.heading * math.pi / 180)
          ny = self.y + d * math.sin(self.heading * math.pi / 180)
          self.lines.append((self.x, self.y, nx, ny))
          self.x, self.y = nx, ny
  
      def save(filename, lines):
          f = open(filename, "w")
          f.write('&lt;svg viewBox="-500 -500 1000 1000"&gt;')
          s = '&lt;line x1="{}" y1="{}" x2="{}" y2="{}" style="{}" /&gt;'
          for i in lines:
              for x1, y1, x2, y2 in i:
                  f.write(s.format(x1, y1, x2, y2, "stroke:black;stroke-width:1"))
          f.write("&lt;/svg&gt;")
          f.close()
  
      # Here is just a try to put more turtles with more lines in one file
      # But I can't do this with 20 turtles...
      def set_turtles():
          global all_lines
          turtle_names = []
          t_red = Turtle(-100, 0)
          turtle_names.append(t_red)
          t1 = Turtle(0, 100)
          turtle_names.append(t1)
          t2 = Turtle(0, -100)
          turtle_names.append(t2)
          for turtle in turtle_names:
              for i in range(4):
                  turtle.forward(10)
                  turtle.left(90)
              all_lines.append(turtle.lines)
          save("drawing_one.html", all_lines)
          f.close()
  </code></pre>