Question #360

What is the output of the code snippet below?
num1 = 100
num2 = 0
try:
    result = num1/num2
    print(result)
except ZeroDivisionError:
    print("A division by zero error occured")

On line 4, a division by 0 happens as num2 = 0 . This results in a ZeroDivisionError exception taking control to line 7 which prints "A division by zero error occured" . (w3schools.com/python/python_try_except.asp)


Comment on Disqus:

Question difficulty: šŸ”µšŸ”µšŸ”µšŸ”µšŸ”µ