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.