title: Labelling Segments in Turtle
body: <p>The following is using Python's Turtle.</p>
  
  <p>I'm trying to put pre-set labels (which are located in a list) next to the corresponding sections on a pie chart I've made in Turtle. The figures change the chart so I need the labels to not be in one place but rather move depending how big each segment of the pie chart is.</p>
  
  <p>This is where I'm stuck. Should I def() so each set of lists change with only one function?
  So far I have this:    </p>
  
  <pre><code>groups = ['Group A', 'Group B', 'Group C', 'Group D']
  percentages = [0.2, 0.4, 0.15, 0.25]
  
  def label():
      penup()
      for percent in percentages:
          setheading((percentages[0] * 360)/2)
          forward(radius + 20)
          color("Black")
          write(groups[0], False, "left", font=("Arial", 15, "bold"))
          end_fill() 
  label()
  </code></pre>
  
  <p>I plan to have 4 of this for each group. But what if there are more than 4 in the groups? And I think it loops because it prints the first group name (Group A) every 20 pixels. A push in the right direction would be greatly appreciated!</p>
  
  <p>Picture of what it looks like: <a href="http://i.imgur.com/eCGdq3E.png" rel="nofollow">http://i.imgur.com/eCGdq3E.png</a></p>