On Sat, May 30, 2009 at 8:20 PM, David <[email protected]> wrote:
>
> Alan Gauld wrote:
>>
>> "David" <[email protected]> wrote
>>
>>> I took this program that determines a fertilizer application rate;
>>> ...
>>> And converted it to class/object to learn how they work. Just looking
for some pointers, if I did it correctly etc.
>>>
>>> <snip>
One thing that's probably not in the scope of the program but really usually
a good idea is error checking.
i.e. this line:
rate = float(raw_input("Enter rate i.e. (0.5) : "))
could be converted to something like:
try:
rate = float(raw_input("Enter rate..."))
except ValueError:
print "Invalid input"
#Quit or loop until valid input is entered.
HTH,
Wayne
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor