occurs when the program is running (e.g division by 0)
or using a undefined variable
detect cases where r.t errors would occur
Specific Exception Handling:
specifying the error type
argument of an exception:
you can capture an exception's argument by supplying a variable in the except clause
answer = raw_input("choose a, b, or c:")
if answer != "a" and answer !="b" and answer !="c":
raise ValueError("Question 1: Invalid Input: please enter a, b, or c")
print "thank you"
except ValueError, errorvar:
No comments yet. Add yours below!
Add a Comment