Question
Write a robust and well-documented (commented) program that asks for two positive integers and returns the result of integer division of the two numbers entered.
Write a robust and well-documented (commented) program that asks for two positive integers and returns the result of integer division of the two numbers entered.
Use Pythons try/except mechanism to catch and print the following errors.
- If the user enters 0 for the second integer, then print out an error message Division by Zero.
- If the user enters anything other than positive integer values, then print out an error message You did not enter a positive integer.
A sample run would be as follows.
Enter a positive integer: five Enter another positive integer: 5 You did not enter positive integer(s). Try again. Enter a positive integer: 5 Enter another positive integer: 0 You entered 0 for the divisor. Try again. Enter a positive integer: 5 Enter another positive integer: 2 The result of integer division is 2.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started