Exception handling in python using try and except

 Exception handling in python using try and except


#exception handling program
print("input value for a:")
a=input()
print("input value for b:")
b=input()
try: #try block check if any error occurs
print("addition of a and b is ", int(a+b))
except Exception as e: #if error occured in try block, exception is handled by except block
print(e)

Comments