Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Azure SQL Database For Modern Developers Building Applications In The Microsoft Cloud

Authors: Davide Mauri, Silvano Coriani, Anna Hoffma, Sanjay Mishra, Jovan Popovic

1st Edition

1484263693, 978-1484263693

More Books

Students also viewed these Databases questions