You can download this code by clicking the button below.
This code is now available for download.
This function takes two arguments and attempts to perform division. If the second argument is zero, it returns an error message.
Technology Stack : Exception handling (ZeroDivisionError), arithmetic operation
Code Type : Exception handling and arithmetic operations
Code Difficulty : Intermediate
def zebra(arg1, arg2):
try:
return arg1 / arg2
except ZeroDivisionError:
return "Cannot divide by zero"