code:-

def add_numbers(a, b):
   if not (isinstance(a, int) and isinstance(b, int)):
       return "Inputs must be integers!"
   return a + b
print(add_numbers(10, 20))
print(add_numbers(10, 20.23))
print(add_numbers('5', 6))
print(add_numbers('5', '6'))
print(add_numbers('5',2.44))
output:-

30
Inputs must be integers!
Inputs must be integers!
Inputs must be integers!
Inputs must be integers!

Post a Comment

If you have any doubts, Please let me know
Thanks!

Previous Post Next Post