Question: i. Write a program to accept only negative integers and print them onto the screen. The program should throw an exception if the input is
i. Write a program to accept only negative integers and print them onto the screen. The program should throw an exception if the input is zero. (hint: use try and Catch block )
ii. Write an example Exception handling code which uses ValueError Exception. Discuss the situation when using a ValueError is better than Exception.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
