title: Python Turtle with user input
body: <p>I want to use python turtle to create a program that asks the user how many sides they want on a polygon, then turtle draws it. Here is my code:</p>
  
  <pre><code>import turtle
  
  window = turtle.Screen()
  window.bgcolor("lightgreen")
  
  shape = turtle.Turtle()
  shape.color("blue")
  shape.pensize(3)
  
  sides = int(input("How many sides do you want? Use digits: "))
  
  def polygon(sides,length):
  
      for x in range(sides):
          shape.forward(length)
          shape.left(360/sides)
  </code></pre>
  
  <p>For some reason this won't work. Any ideas?</p>
  
  <p>Thanks in advance!</p>