Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 ) Write a program that allows an unlimited number of positive integers to be entered ( one line at a time ) . Program

1) Write a program that allows an unlimited number of positive integers to be entered (one line at a time). Program 1 should ask the user to enter the integers with 0(zero) used as the sentinel value (to end the program). If the entry is not a number, not an integer, or is not positive, the program should display a message about the entry not being a positive integer and the user should be prompted for input again without aborting the program.
Be sure to follow the Program Submission Guidelines document and to use only concepts that we've covered in class so far (including the .isdigit() method above). Do not include min(), max(), user defined functions, lists, etc. or you will receive a zero for the assignment.
Ex: Here is an example of the input and output (the input below is italicized for clarification only -- not to be incorporated into the program)
Enter a positive integer, 0 to stop: 4
Enter a positive integer, 0 to stop: 10
Enter a positive integer, 0 to stop: p
That is not a positive integer
Enter a positive integer, 0 to stop: -2
That is not a positive integer
Enter a positive integer, 0 to stop: 4.2
That is not a positive integer
Enter a positive integer, 0 to stop: 0

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

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

More Books

Students also viewed these Databases questions

Question

Introduce yourself with an elevator speech

Answered: 1 week ago