Newbia alert .. working my way through Easy Python Montana Edu page, need help..
kwdotbenninkNOSPAM at 12move.nl
Fri Sep 20 15:27:56 CEST 2002
I'm asked ( on the website : www.honors.montana.edu\_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 " '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):
def square ( width1, height1):
def circle (3.14*radius**2):
return 3.14*radius **2
choice = 'p'
while choice != 'q':
if choice == 'r':
print "result",rect (width,height)
if choice =='s':
c = input ( "width")
d = input ( "height")
print "result",square (width1, height1)
if choice == 'c ':
if choice != 'q':
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