exceptions

Alex the_brain at mit.edu
Thu Oct 5 13:30:20 EDT 2000


You just have the try block in the wrong place.  Try something like
this:

def f(divident):
	L=[2,4,5,0,5,0,8]
	for divisor in L:
                try:
		        print divident/divisor
                except:
                        print '<Division by zero>'
f(100)

Alex.

-- 
Speak softly but carry a big carrot.




More information about the Python-list mailing list