views:

72

answers:

4
from TurtleWorld import *
import math

bob = Turtle()
print(bob)

draw_circle(turtle, r):
    d = r*2
    c = d*math.pi
    degrees = 360/25
    length = c // 25
    for i in range(25):
        fd(turtle, length)
        rt(turtle, degrees)

draw_circle(bob, 25)

wait_for_user()

The problem in on line 7:

draw_circle(turtle, r):

The compiler only tells me that there is a syntax error and highlights the colon at the end of that line. I'm sure I'm missing something simple, but the code looks right to me.

+2  A: 

in python, we define functions using the def keyword.. like

def draw_circle(turtle, r):
    # ...
mykhal
Ahhhhhhh.... I knew it was something obvious. I feel quite silly... Thank you.
Grady Knotts
+1  A: 

You need to write:

def draw_circle(turtle, r):

to define a function.

PreludeAndFugue
+1  A: 

http://docs.python.org/release/3.0.1/tutorial/controlflow.html#defining-functions

Your missing the def part?

Thierry
A: 

I thought, just in case the other three answers weren't obvious enough, I should tell you that you need def first

def draw_circle(turtle, r):

@People duplicating: Seriously, could we get 1 more answer? I believe 3 (4 if you add me) isn't enough

Robus