[Tutor] Quick question about definitions.

Dave Angel d at davea.name
Sat Nov 17 19:31:03 CET 2012


On 11/16/2012 12:28 PM, sillywilly98 wrote:
> I know this code is not fully debugged. I just cant see why 1 definition is
> wrong. <http://python.6.n6.nabble.com/file/n4996080/def.png> 
> Here is the code:
> # This program draws a robot.
>
> from turtle import *
>
> def draw_eyes():
>     # This function
>     penup()
>     color("purple")
>     goto(-50, 200)
>     pendown()
>     begin_fill()
>     circle(20)
>     end_fill()
>     penup()
>     goto(50, 200)
>     begin_fill()
>     circle(20)
>     end_fill(()
The call to end_fil has unmatched parentheses.  That means the
expression continues on the next line.  But def is a keyword and not
valid inside an expression.

def draw_nose():
    # This function 
    penup()
    color("orange")
    goto(0, 150)
    pendown()
    begin_fill()
    circle(20, steps=3)
    end_fill(()

Same here.  But in general, once you fix one error, you can spot the next one more easily. 

<snip>



-- 

DaveA



More information about the Tutor mailing list