title: Python draw n-pointed star with turtle graphics
body: <p>My professor has asked our class to write a Python function that does as following:</p>
  
  <p>Draw a regular n-pointed star with side d - in a function named star(turtle, n, d)</p>
  
  <p>Here's the code that I have so far:</p>
  
  <pre><code>def star(turtle, n, d):
      angle = (180-((180*(n-2))/n))*2
      for i in range(n):
          t.forward(d)
          t.left(angle)
      return angle
  </code></pre>
  
  <p>The problem that I am experiencing is that my function is only able to draw stars with odd numbers of corners (5, 7, 9-sided stars). When I ask it to draw a star with an even number of sides, it outputs polygon with sides n/2. So asking to draw an 8-sided star outputs a square, 6-sided gives a triangle, and so forth.</p>
  
  <p>I've tried altering the angle formula many times, but it never works with any given n.</p>
  
  <p>Thanks for helping!</p>