[Tutor] exceptional behaviour
Kirby Urner
urnerk@qwest.net
Wed, 23 Jan 2002 11:00:55 -0800
>
>def div42():
> denominator=input("What value will I divide 42 by?\n")
> if denominator == 0:
> raise "first problem"
> elif denominator == 1:
> raise "second problem"
> else:
> print 42/denominator
>
>doesn't
What error message to you get for the 2nd example?
Seems to work fine in 2.2:
>>> div42()
What value will I divide 42 by?
0
Traceback (most recent call last):
File "<pyshell#16>", line 1, in ?
div42()
File "<pyshell#15>", line 4, in div42
raise "first problem"
first problem
Kirby