Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Code example of Python Modulo Operator with Exception handling

# inputs
a = 14
b = 0
  
# exception handling
try:
    print(a, 'mod', b, '=', a % b, sep = " ")
      
except ZeroDivisionError as err:
    print('Cannot divide by zero!' + ' Change the value of the right operand.')
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Code #Python #Modulo #Operator #Exception #handling
ADD COMMENT
Topic
Name
5+4 =