Advertisement
elena1234

Error handling in Python

Feb 9th, 2022
806
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.16 KB | None | 0 0
  1. def func (num1, num2):
  2.     try:
  3.         return num1 / num2
  4.     except(TypeError, ValueError) as error:
  5.         raise error
  6.  
  7. print(func(1, "4"))
  8.        
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement