You can download this code by clicking the button below.
This code is now available for download.
This custom function attempts to divide the first argument by the second argument. If the second argument is zero, it catches the exception and returns an error message.
Technology Stack : Exception handling
Code Type : Exception Handling Function
Code Difficulty :
def aaaa(arg1, arg2):
try:
return arg1 / arg2
except ZeroDivisionError:
return "Cannot divide by zero"