Catching Two Exceptions : Except : Statement PYTHON TUTORIALS


PYTHON TUTORIALS » Statement » Except »

 

Catching Two Exceptions


try:
   x = input('Enter the first number: ')
   y = input('Enter the second number: ')
   print x/y 
except ZeroDivisionError:
   print "The second number can't be zero!" 
except TypeError:
   print "That wasn't a number, was it?"



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Statement
» Except