#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    4
    Rep Power
    0

    Question Quick question about simple code


    I know this code is not fully debugged. I just cant see why the highlited definition is wrong.
    l00k at http://python.6.n6.nabble.com/file/n4996080/def.png
    Here is the complete code:

    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(() 
    
    def draw_nose(): 
        # This function 
        penup() 
        color("orange") 
        goto(0, 150) 
        pendown() 
        begin_fill() 
        circle(20, steps=3) 
        end_fill(() 
    
    def draw_mouth(): 
        # This function 
        penup() 
        color("pink" 
        goto(-50, 100) 
        pendown() 
        begin_fill() 
        forward(100) 
        right(90) 
        forward(20) 
        right(90) 
        forward(100) 
        right(90) 
        forward((20) 
        right(90) 
        end_fill() 
    
    def draw_head(): 
        # This function 
        draw_eyes() 
        draw_nose() 
        draw_mouth() 
        penup() 
        color("blackk") 
        goto(-100, 50 
        pendown() 
        goto(100, 50) 
        goto(100, 275) 
        goto(-100, 275) 
        gto(-100, 50) 
    
    def draw_panel(): 
        # This function 
        penup() 
        color("grey") 
        width(4) 
        goto(-75, 0) 
        pendown() 
        goto(75, 0) 
        goto(75, -100) 
        goto(-75, -100) 
        goto(-75, 0) 
        penup() 
        clor("red") 
        goto(-25, -50) 
        pendown() 
        circle25, steps=3) 
        penup() 
        color("green") 
        goto(25, -50) 
        pendown() 
        rght(180) 
        circle(25, steps=3) 
        right(180) 
    
    def draw_arm(): 
        # This function 
        pendown() 
        color("black") 
        width(2) 
        right(90") 
        forward(150) 
        right(90) 
        forward(25) 
        color("red") 
        begin_fill() 
        circle(50) 
        end_fill() 
        color("black") 
        forward(25) 
        right(90) 
        forward(150) 
        right(90) 
        forward(50) 
    
    def draw_body(): 
        # This function 
        draw_panel() 
        penup() 
        color("black") 
        width(1)) 
        goto(-150, 50) 
        pendown() 
        goto(150, 50) 
        goto(150, -250) 
        goto(-150, -250) 
        goto(-150, 50) 
        draw_arm() 
        penupp() 
        goto(200, 50) 
        draw_arm() 
        
    draw_head() 
    draw_body() 
    
    exitonclick)
    I hope you can tell me what is wrong.
    All help is greatly apperciated.
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,856
    Rep Power
    481
    You scatter bad parentheses throughout your program.

    Code:
    exitonclick)  #  hello!!!!  exitonclick()
    
    
    end_fill(()    # what????  Fix them all and try again.
    [code]Code tags[/code] are essential for python code and Makefiles!
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    4
    Rep Power
    0
    Originally Posted by b49P23TIvg
    You scatter bad parentheses throughout your program.

    Code:
    exitonclick)  #  hello!!!!  exitonclick()
    
    
    end_fill(()    # what????  Fix them all and try again.
    my image did not show up it says the second def is wrong. I have no idea why.
    (image only shows up when I preview my post)
    http://python.6.n6.nabble.com/file/n4996080/def.png
  6. #4
  7. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,856
    Rep Power
    481
    Code:
    3 matches for "((" in buffer: p.py
         18:    end_fill(() 
         28:    end_fill(() 
         43:    forward((20)
    right(90") # wrong


    exitonclick) #wrong

    penupp() # wrong

    circle25, steps=3) # wrong

    I didn't attempt to make program to work. Don't expect us to find all your careless crap.

    You've been careless---a trait that won't work for programmers.
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo