# This is a non-sense program to illustrate # the try/except statement works # Comment out each of the incorrect lines in turn to see # how it works. #Suppose a, b, and c values were input from the user a = 0 b = 54 c = "" try: y = 3/a x = "hello" x[b] z = float(c) except ZeroDivisionError: print("zero division error when assigning to y") except ValueError: print("your float statement is wrong when assigning to z") except IndexError: print("you have a value out of range when accessing x") except: print("error32.") # (1) You can print your own, more informative error messages, # including relevant variable values. # (2) You have to write less code to verify values - the # computer is already checking for all these conditions print ("Still here!") # (3) Your code keeps executing!