"Thinking like CS" problem I can't solve

Alex Pavluck apavluck at gmail.com
Tue May 23 12:43:40 EDT 2006


Hello.  On page 124 of "Thinking like a Computer Scientist".  There is
an exercise to take the following code and with the use of TRY: /
EXCEPT: handle the error.  Can somone help me out?  Here is the code:


def inputNumber(n):
    if n == 17:
        raise 'BadNumberError: ', '17 is off limits.'
    else:
        print n, 'is a nice number'
    return n

inputNumber(17)




More information about the Python-list mailing list