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
Microsoft <br> Excel Module 6
Sonbull [250]

Answer:

what Is your question?

6 0
3 years ago
What is true of softboxes?
gizmo_the_mogwai [7]
Softboxes have an umbrella on the front. The answer to your question is A. I hope that this is the answer that you were looking for and it has helped you.
4 0
3 years ago
Read 2 more answers
On laptops with a smart card reader installed, where is the smart card reader usually located?
dem82 [27]
Plenty of space in the palm rest
4 0
3 years ago
You realize your computer has been infected with malware. It seems as if someone is controlling your computer from a remote loca
lara [203]

Answer:

Worm malware

Explanation:

The worm operates destructively as it replicates itself and keeps spreading within a computer or network. It takes advantage of software and security vulnerabilities.

Once a computer or network is infected, worms replicate themselves, therefore using up the computer and network resources. Among others, one of the major missions of worms is to create a backdoor into a network, to be able to enable the attacker to carry out a more devastating attack.

Since worms take advantage of weak security in the Operating system, it is very important to constantly update the security features of the Operating system. Users must be careful of the emails they open and attachments they download.

6 0
3 years ago
Explain the working principle of computer? can anyone tell​
Crazy boy [7]

Answer:

input process and output hehe

4 0
3 years ago
Other questions:
  • The function takes two string parameters; the first is the name of a file and the second is text. Complete the function to appen
    7·1 answer
  • Importance of project risk management
    10·1 answer
  • using C++ to sort user input. for example, user enter 25numbers and sort them from small to big or big to small, cout thesamlles
    6·1 answer
  • michelle works in retail and cant decide what products to include in the stores front window display. what is the first step she
    10·2 answers
  • Which describes the first step a crawler-based search engine uses to find information?
    10·2 answers
  • How do you get a crown on this website<br> look under your points on the right side of your picture
    15·2 answers
  • X = 1 if (A = 1 OR B = 1) OR (A = 0 AND B = 1
    7·1 answer
  • Which terms means device that converts one voltage to another ?
    15·1 answer
  • Why does a computer need memory​
    15·2 answers
  • Which of these statements performs real number quotient division using type casting?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!