Question: (NEEDS TO BE ON PYTHON 2.7) HW 8 continue - break Create an application that uses both continue and break. Your application should sum positive

(NEEDS TO BE ON PYTHON 2.7)

HW 8 continue - break

Create an application that uses both continue and break.

Your application should sum positive integers using a while loop

Declare two variables, count and sum and set their values to 0.

Use raw_input to get numbers from your user

Wrap the raw_input and conversion in a try.

Use except to catch bad input

Except should print an error message: Noninteger input and use continue to begin a new itereation

Use if-elif-else to handle these three cases:

Case 1: Positive integer input is summed and counted

Print out the values of count and sum

Case 2: 0 value input is ignored

Use continue

Print out a message saying that zero was entered

Case 3: A negative value will terminate the loop

Print a message Negative value entered loop terminating

Use break

(NEEDS TO BE ON PYTHON 2.7) HW 8 continue - break Createan application that uses both continue and break. Your application should sum

8-continue-break HW Create an application that uses both continue and break. Your application should sum positive integers using a while loop Declare two variables, count and sum and set their values to 0. Use raw nput to get numbers from your user wrap the raw input and conversion in a try. Use except to catch bad input Except should print an error message "Noninteger input" and use continue to begin a new itereation Use if elif else to handle these three cases Case 1: Pos tive integer input is summed and counted Print out the values of count and sum Case 2: 0 value input is ignored Use continue Print out a message saying that zero was entered Case 3: A negative value will ate the loop termin Print a message "Negative value entered oop terminating Use break 8-continue-break HW Create an application that uses both continue and break. Your application should sum positive integers using a while loop Declare two variables, count and sum and set their values to 0. Use raw nput to get numbers from your user wrap the raw input and conversion in a try. Use except to catch bad input Except should print an error message "Noninteger input" and use continue to begin a new itereation Use if elif else to handle these three cases Case 1: Pos tive integer input is summed and counted Print out the values of count and sum Case 2: 0 value input is ignored Use continue Print out a message saying that zero was entered Case 3: A negative value will ate the loop termin Print a message "Negative value entered oop terminating Use break

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!