Error and Exception Handling · 10 / 20 Exercise Medium

Handling multiple exceptions

Objective

Write a program that asks for a string and a number. Try to convert the string to an integer and divide it by the number. Catch possible errors such as ValueError or ZeroDivisionError and print an appropriate message in each case.
Input
abc
2
Output
Invalid number

Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.

Start exercise