try and except exception in the python

technical talkiess
0


try and except exception is used the when program through an error but remaining proram not break and run.

 print("Enter the first number")

num1 = input()
print("Enter the second number")
num2 = input()

try:
    print("The sum of the two number is ",
          int(num1)+(num2))
except Exception as e:
    print(e)

print("All Program run successfully")


Tags

Post a Comment

0Comments

Thanks you for commenting your questions. I will see question and respond you.

Post a Comment (0)