Answers for "exception python division by zero"

0

divide by zero error python exception handling

try:
    print 1/0
except ZeroDivisionError:
    print "You can't divide by zero!"
Posted by: Guest on January-29-2021
0

handling zero division error in python

x = 0
try:
  answer = 1/x
except ZeroDivisionError:
  answer = 'undefined'
print('The answer is {result}'.format(result=answer)
Posted by: Guest on May-25-2021

Code answers related to "exception python division by zero"

Python Answers by Framework

Browse Popular Code Answers by Language