Python Programming - Exception Handling - Discussion
Discussion Forum : Exception Handling - General Questions (Q.No. 2)
2.
Consider the following Python code:
try:
result = 10 / 0
except ZeroDivisionError:
result = "Error: Division by zero"
What will be the value of "result" after the execution of this code?
Answer: Option
Explanation:
The code attempts to divide by zero, which raises a
ZeroDivisionError
. The exception is caught, and "result" is assigned the string "Error: Division by zero."
Discussion:
Be the first person to comment on this question !
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers