Python range(%d) % sides
Question: I am trying to make a program, that uses the turtle module using Python
2.7.5+. The user can input a integer so I want to use that number as a
argument for range()

Here is my code so far:

    
    
    import turtle
    import time
    sides = int(raw_input("Enter the amount of sides you want!"))
    angle = float(360 / sides)
    length = int(raw_input("Enter the length of each side!"))
    #Starts turtle drawer
    turtle = turtle.Turtle()
    def turtleDrawer():
        for i in range (%d) : % (sides)
            turtle.fd(%d) % (length) 
            turtle.rt(%d) % (angle)
    ws = turtle.Screen()
    turtleDrawer()
    time.sleep(10)
    

When this code is executed, it gives me a syntax error, highlighting the `%`
sign in the brackets.


Answer: `for i in range (%d) : % (sides)` is invalid. This type of
[formatting](http://docs.python.org/2/library/stdtypes.html#string-formatting)
is used for strings, not for conditional statements.

You are looking for this statement:

    
    
    for i in range(sides):
    

