Newbia alert .. working my way through Easy Python Montana Edu page, need help..

Highwaykind kwdotbenninkNOSPAM at
Fri Sep 20 09:27:56 EDT 2002

I'm asked ( on the website :\_jjc\easytut
\node10.html ) to write a small programm to calculate rectangle, square 
and circle thingies( forgot the English word .. ) and I came up with 
this code : 

def print_options() :
    print "options:"
    print " 'p' print options"
    print " 'r' Calculate area rectangle"
    print " 's' Calculate area square "
    print " 'c' Calculate area circle "
    print " 'q' Quit"

def rect (width,height):
    return width*height
def square ( width1, height1):
    return width1*height1
def circle (3.14*radius**2):
    return 3.14*radius **2

choice = 'p'
while choice != 'q':
    if choice == 'r':
        a=input ("width")
        b=input ("height")
    print "result",rect (width,height)
    if choice =='s':
        c = input ( "width")
        d = input ( "height")
    print "result",square (width1, height1)
    if choice == 'c ':
        f=input ("radius")
    print "result",circle
    if choice != 'q':
        choice=raw_input ("option")

But the thing keeps telling me width is not defined, also I can;t use 
the ELIF command .. THink I could do with some help :)

For the correct e-mail address : remove NOSPAM and replace dot with .

More information about the Python-list mailing list