Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Programming (http://www.go4expert.com/forums/programming-forum/)
-   -   Need help, Invalid Syntax (http://www.go4expert.com/forums/help-invalid-syntax-t1261/)

Ge'ez 25Aug2006 18:53

Need help, Invalid Syntax
 
Sorry if this is the wrong section to post this.

I'm starting to learn Python as my first program and I'm trying to do the exercise at the bottom of this tutorial page (http://www.honors.montana.edu/~jjc/e...tut/node9.html)

Here's what I have but I keep getting an error ("There's an error in your program:invalid syntax") when I try to Run>Run Module.

Code:

def print_options():
    print "Options:"
    print "'p' print options"
    print "'r' Area of a rectangle"
    print "'s' Area of a square"
    print "'c' Area of a circle"
    print "'q' quit the program"

def rec_area(l,w):
    rarea = l*w
    return rarea
def squ_area(l,w):
    sarea = l*w
def cir_area(r):
    carea = 3.14*r**2

choice = "p"
while choice != "q":
        if choice == "r":
            l = input ("Length:")
            w = input ("Width:")
            print "The area of this rectangle=", rec_area(l,w)
        elif choice == "s":
            l = input ("Length:")
            w = input ("Width:")
            print "The area of this square=", def squ_area (l,w}
        elif choice == "c":
            r = input ("Radius:")
            print "The area of this circle=", def cir_area(r)
        elif choice != "q":
            print_options()
        choice = raw_input("Option:")


TEJUS 31Aug2006 19:48

Re: Need help, Invalid Syntax
 
sorry,i think this is not the right place for u to post such posts.if i have learnt python then surely i
was going to help u .Don't worry ,if u have any doubts in C (not C++) then ask me.


All times are GMT +5.5. The time now is 19:11.