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
A line beginning with a # will be transmitted to the programmer’s social media feed.
zhenek [66]

Answer:

True?

Explanation:

4 0
3 years ago
Read 2 more answers
A technician wants to limit access to a group of folders and is using Group Policy to prevent the users in the sales department
Mashcka [7]

Answer:

d. The technician should be setting NTFS permissions instead of using Group Policy.

Explanation:

NTFS (New Technology File System) permissions run on drives formatted with NTFS.Under NTFS permissions, individual users are granted permission at the Windows logon and so in this way local users and network users are affected, affecting each user from wherever he may be connecting from. In the example above using NTFS permissions would solve the problem of file system among departments .

4 0
2 years ago
Write down the stages in the information prcessing cycle in correct order​
Naddika [18.5K]

Answer:

The answer is below

Explanation:

The various stages in the information processing cycle in the correct order​ is as follows:

1. Input stage: this is when the data is sent into the computer through the hardware

2. Processing stage: this when the is being refined in the central processing unit of the computer

3. Storage stage: this is when the data is being saved or stored in the computer memory such as Hard drive or external storage such as Flash drive

4. Output stage: this is when the refined or processed data is produced to the user either through the monitor screen or printing

4 0
3 years ago
What are the raw materials for the process of photosynthesis​
Ray Of Light [21]
The raw materials of photosynthesis, water and carbon dioxide, enter the cells of the leaf, and the products of photosynthesis, sugar and oxygen, leave the leaf.
7 0
2 years ago
Read 2 more answers
What activities are the most likely to infect your computer vith a virus? Check all that apply.
Gnesinka [82]

Answer:A,B,E

Explanation:

I just took the quiz

5 0
3 years ago
Other questions:
  • Why don't we get together to watch the Academy Awards?
    15·2 answers
  • What is a fragment shader? Question 5 (3 marks) What is trilinear filtering?
    8·1 answer
  • Janelle is shopping for jeans from Express. She clicks on a style she likes. The site quickly presents her with a close-up view
    5·1 answer
  • What is the single most important component of a computer? Central Processing Unit DIP Motherboard Chipset
    8·1 answer
  • If Tracy starts on the left edge of the canvas and moves forward 50 pixels, how many times will this code need to be repeated to
    5·1 answer
  • What element is not a selection in the Interface preferences? UI Character Presets UI Font Size UI Language UI Scaling
    9·1 answer
  • Que es un programa de ordenador?
    10·1 answer
  • What is computer sences​
    6·1 answer
  • HELP MY TABLET KEEPS ON REBOOTING I TRIED TO FACTORY RESET BUT IT KEEPS ON REBOOTING
    12·2 answers
  • Ethics related to all <br> artificial intelligence?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!