Ebony C. answered 01/25/23
Current software developer with 4+ years of professional experience
This should be encapsulated into a function for testing and reusability
Dhanu P.
asked 11/30/22Write a program that reads integers user_num and div_num as input, and output the quotient (user_num divided by div_num). Use a try block to perform all the statements. Use an except block to catch any ZeroDivisionError and output an exception message. Use another except block to catch any ValueError caused by invalid input and output an exception message.
Note: ZeroDivisionError is thrown when a division by zero happens. ValueError is thrown when a user enters a value of different data type than what is defined in the program. Do not include code to throw any exception in the program.
Ex: If the input of the program is:
the output of the program is:
Ebony C. answered 01/25/23
Current software developer with 4+ years of professional experience
This should be encapsulated into a function for testing and reusability
Get a free answer to a quick problem.
Most questions answered within 4 hours.
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.