How to catch exception for multiple validation in a single try block ? Is it possible or do I need to use multiple try block for that ? Here is my code :
import sys
def math_func(num1, num2):
return num1*num2
a,b = map(str,sys.stdin.readline().split(' '))
try:
a = int(a)
b = int(b)
print("Result is - ", math_func(a,b), "\n")
except FirstException: # For A
print("A is not an int!")
except SecondException: # For B
print("B is not an int!")