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)
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)
Comment