1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
tresset_1 [31]
2 years ago
10

Write a loop that reads positive integers from standard input and that terminates when it reads an integer that is not positive.

After the loop terminates, it prints out, on a single line and separated by a single space, the sum of all the even integers read and the sum of all the odd integers read. python
Computers and Technology
1 answer:
Paraphin [41]2 years ago
3 0

Answer:

The program to this question as follows:

Program:

#defining variable and assign value

odd=0  

even=0  

i=1  

print('Input 0 after inserting all number: ') #print message

while i>0: #define loop for check inserting and add all number

   i=int(input()) #input value by user end

   if (i< 0): #check value is not positive

       break

   if ((i % 2)==0and(i>0)): #check even number condition

       even=even+i #add even numbers

   if ((i % 2)!=0and(i>0)): #check odd number condition

       odd=odd+i #add odd numbers

print ('Sum of Even number:',even,'and','Sum of Odd number:',odd) #print value

Output:

Input 0 after inserting all number:  

1

2

3

5

7

0

Sum of Even number: 2 and Sum of Odd number: 16

 Explanation:

In the above python program, three variable is defined, that is "even, odd and i", in which "even and odd" variable assign value that is "0", and the variable i is used for inserting elements from user. In the next line a while loop is defined that inserts numbers in variable "i", in this loop, 3 if block is used that can be defined as follows:

  • In first if block variable "i", checks that value is non-positive number if this condition is true, it will break the loop.
  • In second if block this block check even number condition and add in even variable.
  • In third, if block this block check odd number condition and add in odd variable.  

End of the loop we use print function that prints the sum of even numbers and odd numbers.

You might be interested in
PODARDSRTH?HOW SPELLING
Amiraneli [1.4K]
Sorry, I d0nt understand
8 0
2 years ago
SOME PLEASEE HELP!!<br> (has to be 4 paragraphs)
natali 33 [55]

Answer:

Ahhh i wanna help so bad hold on

Explanation:

4 0
2 years ago
That’s the photo you where asking for
jek_recluse [69]
I think the answer is C
4 0
3 years ago
Read 2 more answers
Laura has a list of the SAT scores of over a thousand students. She needs to write to the top 10 students but exclude students t
fiasKO [112]
D.)Laura can apply a Filter for the top 10 students and a Filter for which schools to exclude from the results.
3 0
3 years ago
Read 2 more answers
Anna would like to send data from her database to a coworker who is using spreadsheet software. Anna should _____.
Zinaida [17]

In order to send data from her database to a worker who is using spreadsheet software, Anna should export the data to the spreadsheet.

b. export the data to a spreadsheet

<u>Explanation:</u>

Printing the database in table form and handing it to the co-worker so that they can manually enter the data in the spreadsheet will work but it is a time-consuming process and will take a lot of effort in copying the data from the printed database and is prone to errors.

The co-worker can make mistakes in data entry and it can lead to consequences. The worst-case can be the exchange of vital information of entities.

4 0
3 years ago
Other questions:
  • The default view in word is ____ view, which shows the document on a mock sheet of paper in the document window.
    6·1 answer
  • What does the proofreading mark "..." mean?
    14·2 answers
  • what type of clause must you always use with DEKETE or UPDATE to avoid inadvertently changing data elsewhere in the database​
    12·1 answer
  • Clunker Motors Inc. is recalling all vehicles in its Extravagant line from model years 1999-2002 as well all vehicles in its Guz
    15·1 answer
  • Which of the following is used to track and gather information without knowledge or authorization?
    8·2 answers
  • To save a presentation, tap or click the save button on the Blank
    8·1 answer
  • _____ is an example of a Google filetype operator.​
    13·1 answer
  • Please, give me a comic or story idea. I will mark brainliest. ( i need 5 slides with 2 characters in the story or comic) Please
    8·2 answers
  • ________ programs help solve the problem of running out of storage space by providing lists of application programs, stored vide
    13·1 answer
  • assuming the default gateway is connected to the internet, what type of internet access would this server have?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!