title: Python Draw a Nested Square
body: <p>I'm working on writing a recursive function to draw nested squares around a central point using <a href="http://docs.python.org/2/library/turtle.html" rel="nofollow">turtle</a>. What I have so far draws nested squares but around a corner point not the center of the square.</p>
  
  <pre><code>def drawCentSq(t, center,side):
  
      xPt=center[0]
      yPt=center[1]
      t.up()
      t.goto(xPt,yPt)
      xPt-=20
      yPt+=20
      t.up()
      t.goto(xPt,yPt)
      t.down()
      for i in range(4):
          t.forward(side)
          t.right(90)
  
  
  def drawNestSqCent(t, center, side):
      if side&lt;1:
          return
      else:
          drawCentSq(t,center,side)
          drawNestSqCent(t,center,side-10)
  
  def main():
      import turtle
      import random
      mad=turtle.Turtle()
      wn=mad.getscreen()
      print(drawNestSqCent(mad,(0,0),100))  
  main()
  </code></pre>
  
  <p>Any suggestions or corrections?</p>