Question:
Write a function to compute 1 /0 and use try/except to catch the exceptions.

Program:

Explanation:

Even if a statement or expression is syntactically correct, it may cause an error when an attempt is made to execute it. Errors detected during execution are called exceptions and are not unconditionally fatal.

try statement may have more than one except clause, to specify handlers for different exceptions. At most one handler will be executed. Handlers only handle exceptions that occur in the corresponding try clause, not in other handlers of the same try statement. An except clause may name multiple exceptions as a parenthesized tuple.

Output:

Do share your feedback in comments to help us adding more programs like this.

Checkout more Python Programs

Click here

Leave a Reply

bodrum escort - eskişehir esc - mersin escort - mersin escort bayan - mersin esc