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
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started