Thursday, May 2, 2024

BCA PART B 7. Demonstrate Exceptions in Python

 a=int(input('Enter value of a: '))

b=int(input('Enter value of b: '))

try:
print('a/b=',a/b)
except ZeroDivisionError:
print("Sorry, Zero in the denominator.")

No comments:

Post a Comment