Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(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

image text in transcribedimage text in transcribed

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

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

Data Mining Concepts And Techniques

Authors: Jiawei Han, Micheline Kamber, Jian Pei

3rd Edition

0123814790, 9780123814791

More Books

Students also viewed these Databases questions

Question

How do modern Dashboards differ from earlier implementations?

Answered: 1 week ago