python - I want to ask about this exceptionquestion -
here code
class e3exception(exception): pass class e3oddexception(e3exception): pass def raiser (x): if (int(x)%2==1): raise e3oddexception elif (int(x)%2==0): x=int(x) elif (x=='csc148'): raise e3exception('hi brian') elif (isinstance(x, str)==true & isinstance(int(x), int)==false & x!='csc148'): raise valueerror else: raise typeerror
i tried run raise(csc148
) kept getting following error, know why?
traceback (most recent call last): file "<string>", line 1, in <fragment> builtins.typeerror: exceptions must derive baseexception
Comments
Post a Comment