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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!