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
What is an elliptic curve cryptosystem (ECC)?
andrezito [222]

Answer:

d. Provides a stronger cryptographic result with a shorter key.

Explanation:

The elliptic curve cryptosystem (ECC) is a public key cipher that provides higher security than other public key cryptosystems, such as the RSA, with shorter key.

So the correct answer is:

d. Provides a stronger cryptographic result with a shorter key.

3 0
3 years ago
Technician A says that if you add pre-lube to a sealing lip of an axle seal, it will cause the seal to leak causing the bearings
Verizon [17]
Technician B because you put grease on the sealing lip
7 0
3 years ago
A(n ____ is information that a web server stores on a client computer, such as the client’s preferences when accessing a particu
gayaneshka [121]
<span>A COOKIE is information that a web server stores on a client computer, such as the client’s preferences when accessing a particular web site, or where the client has been on the web site.</span>
7 0
3 years ago
There are three types of value for money. Which of the following is not a method of value?
AlladinOne [14]
The answer to this question is c
4 0
3 years ago
Broker Ray is closely acquainted with the Subdivision Heights neighborhood of his town. Over the year, Ray has made it a practic
spin [16.1K]
No multiple choice?
4 0
3 years ago
Other questions:
  • Complete the recursive function raisetopower(). ex: if userbase is 2 and userexponent is 4, then raisedvalue is assigned with 16
    5·1 answer
  • 2. What is the purpose of an outline? (1 point)
    8·1 answer
  • which tag does not display the text in the browser window and makes the sources code mode readable ?​
    6·1 answer
  • Jax needs to write a block of code that will organize a list of items alphabetically. Which function should he use? append() pri
    12·1 answer
  • Optimizing a network to handle more traffic by adding new specialized software is an example of ______ scaling. Adding additiona
    9·1 answer
  • Edhesive coding practice 3.4​
    13·2 answers
  • A solid understanding of __________ is the foundation of verbal communication
    7·1 answer
  • Which of the following technologies is an example of social media
    12·1 answer
  • Mark and his team are working on a project that is due for delivery in the next few days. The team is using project management t
    10·1 answer
  • Summary about Interface Design in system analysis
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!