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
sweet [91]
3 years ago
6

Write a Python program that will take as input 5 integer values and will output the average of the odd values and the average of

the even values that were input. You will need to use if and elif statements to classify each value as odd or even. Be sure to keep track of how many odd values and even values you have, so you can calculate the correct average for each set of values.

Computers and Technology
1 answer:
8_murik_8 [283]3 years ago
6 0

Code:

Here is the code. Also screenshot of the code and text file containing the code have been attached here.

This code has been written in Python 3.0

# getting input

lst = [ ]  

n = 5  

for i in range(0, n):  

   ele = int(input())  

   lst.append(ele)

print(lst)

# getting odd numbers and even numbers from list and compute average

odd_sum = 0

even_sum = 0

odd = 0

even = 0

for i in range(0, n):  

   if lst[i] % 2 == 0:

       even_sum = even_sum + lst[i]

       even = even + 1

   elif lst[i] % 2 > 0:

       odd_sum = odd_sum + lst[i]

       odd = odd + 1

       

odd_avg = odd_sum/odd

even_avg = even_sum/even

print("there were",odd,"odd numbers in input")

print("there were",even,"odd numbers in input")

print("average of odd numbers in the list",odd_avg)

print("average of even numbers in the list",even_avg)

You might be interested in
Who initially developed what is now known as the internet?
Lyrx [107]

in 1990, when computer scientist Tim Berners-Lee invented the World Wide Web.

5 0
3 years ago
Caleb is working in an Excel spreadsheet and realizes that he incorrectly spelled a word he used in multiple cells. Which can Ca
Irina18 [472]
Given the situation above regarding the error that Caleb made in the spelling of a particular word which was repeated in multiple cells, the steps that he can do in order to correct this are the following:
1. G<span>o to Review, Spelling, and select Change each time the error is found.
2. G</span><span>o to Home, Editing, Find, search for the incorrect spelling, and Replace to replace it with the correctly spelled word.
Hope this helps.</span>
5 0
3 years ago
Explain how a message is transmitted from one computer to another using layers.
nevsk [136]
I need some answer chouices but they use iphones
7 0
3 years ago
What is one task of a system optimization tool?
8_murik_8 [283]

Answer: Identifies what apps start on boot

Explanation: sys opt tools find things that are slowing down your device so anything within that lens will work cleaning sys storage could also work as an answer

6 0
4 years ago
Read 2 more answers
What symbol indicates that material has been copyrighted?
polet [3.4K]

Answer:

Ermmmmmm...

I Think if a thing doesn't hhave a trademark or something like that.

Explanation:

Up there

3 0
3 years ago
Read 2 more answers
Other questions:
  • Microsoft Paint can be described as a digital sketch pad ?
    8·1 answer
  • William would like to sort a list of items after the data is already entered.
    9·1 answer
  • Having plug and play support means you can plug in a device, turn on the computer, and then immediately begin using the device t
    11·1 answer
  • Hich function would be used to remove a section of text from a document?
    12·1 answer
  • Suppose that a computer can run an algorithm on a problem of size 1,024 in time t. We do not know the complexity of the algorith
    14·1 answer
  • An information system report is an example of...
    13·1 answer
  • In this problem you will test and analyze the following sorting algorithms: Selection, Bubble, Insertion, Merge, and Quick. You
    14·1 answer
  • How does one select an entrepreneurial activity?
    9·1 answer
  • Adding Calculator Write a program that simulates an adding machine. Input to the program will be integers, submitted one per lin
    15·1 answer
  • I need help ASAP which option is an example of a resource that would most likely become a constraint in building a game
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!