Write a python program to handle multiple errors with one except statement

 a=int(input("Enter The First Number:"))

b=int(input("Enter The Second Number:"))

list1=[1,2,3,4,5]

try:

    c=a/b

    print("The Division Result is",c)

    print(list1[10])

except (ZeroDivisionError,IndexError):

    print("Please see the try block their is exception\nIt may be Zero Division or Invalid Index")

else:

    print("No Exception")

finally:

    print("GoodBye!")


Comments

Popular posts from this blog

Write a python program to compute cumulative product of a list of numbers (write function cumulative_product).

Write a Python program to compute distance between two points taking input from the user. Formula for Pythagorean theorem for compute distance between two points is: