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
Can Any body Define what is search engine in a simple language quick please​
Komok [63]

Answer:

It is the SQL of WWW. Or in other words, it is the web tool that helps the users in locating the required information on the WWW. Various top search engines are like Google, MSN, and Yahoo. And the information that is gathered by the spider is used for creating the searchable index for the content on the web. This spider crawls according to the search engine algorithm and that is known as web crawling.

Explanation:

Please check the answer section.

6 0
3 years ago
Maria works for MegaCorp, a large privately owned company specializing in sales of ball bearings. MegaCorp introduces filtering
ololo11 [35]

Answer:

No, because it would be generally free for private-sector employees by using filtering software to restrict access to some websites.

Explanation:

Maria working for the following Corporation, a major private-owned company that specializes throughout ball bearings production. That corporation establishes filtering software to restrict access to some of these sites linked to non-work, and also some sites with poπnographic images.

So, Maria could not challenge that policy lawfully, as private-sector employees are usually free to always use filtering software to restrict access to some of these Websites

3 0
3 years ago
The default case is required in the switch selection statement.
babunello [35]

Answer: False

Explanation:

 The given statement is false, as it is not compulsory that the default case is require in switch selection statement. If the default case are not properly specified in the statement then, there will be no execution occur in the switch selection statement.

It is sometimes good to have default case in switch selection statement, but it is not mandatory. The default case only executed when the correct case is present and none of the case matches in the given statement.

5 0
3 years ago
In the retrieval phase of Godden and Baddeley (1975) study of the encoding specificity principle, participants were asked to sup
kicyunya [14]

Answer:

recall

Explanation:

Based on the scenario being described within the question it can be said that this was a recall measure of memory. In the field of neuroscience, a recall test refers to a type of test in which subjects are shows a certain stimuli and are later asked to remember as many stimuli as they can. Which in the case of the Godden and Baddeley (1975) study the stimuli were a set of words that were shown to the subjects.

5 0
3 years ago
A business has recently deployed laptops to all sales employees. The laptops will be used primarily from home offices and while
lys-0071 [83]

C. OS hardening.

Making an operating system more secure. It often requires numerous actions such as configuring system and network components properly, deleting unused files and applying the latest patches.

The purpose of system hardening is to eliminate as many security risks as possible. This is typically done by removing all non-essential software programs and utilities from the computer.

5 0
3 years ago
Other questions:
  • Impact of computer on education
    6·2 answers
  • Write a Python program that gets a single character from the user and writes out a congratulatory message if the character is a
    9·1 answer
  • A(n) ____________________ is a set of programs that coordinates all the activities among computer or mobile device hardware.
    10·1 answer
  • Write a program using nested loop to produce the following output:
    6·1 answer
  • Which phrase is a comparison operator for inserting a not equal to argument in an IF, COUNTIF or SUMIF function? <= <>
    9·1 answer
  • Websites that group individuals and organizations into clusters or groups based on some sort are considered to be what type of n
    11·1 answer
  • Which of the following statements is TRUE?
    11·1 answer
  • After fixing the format of her subheadings, she notices that she misspelled the name of one of the famous people
    7·2 answers
  • Ayuda no encuentro la información de estas tres preguntas:
    10·1 answer
  • 01110101<br> +00100100<br> 00010001
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!