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
1
Dimas [21]

Answer:

C.  

Explanation:

Plato users

8 0
2 years ago
_____ is a higher-level, object-oriented application interface used to access remote database servers
makkiz [27]
RDO.

RDO uses the lower-level DAO and ODBC for direct access to databases.
7 0
1 year ago
In which area is composing for games different from composing for movies?
kondaur [170]

Answer: royalties earned

Explanation:

In areas such as the looping scores, temp tracks and adaptive scores, there are similarities when composing for games and when composing for movies.

The area where there is difference when composing for games and composing for movies is the royalties earned. The interest that is earned on royalties for both cases are different.

8 0
3 years ago
True or false for a given set of input values, a nand
Katen [24]
Nand stands for "not and". The truth table for a nand is:

a b | a nand b
0 0 |      1
0 1 |      1
1 0 |      1
1 1 |      0

Hopefully this helps you answer your question.
6 0
3 years ago
A vacation snapshot is an example of the type of photography described as ?
MAXImum [283]
<span>Vacation snapshot photography is not a new idea. I feel for underwater photography, especially if you ever want to grow past taking a few snapshots. The seaside is perhaps the most popular location for snapshot photography. We can find easily seaside snapshots in many gatherings.</span>
4 0
3 years ago
Read 2 more answers
Other questions:
  • How can u refer to additional information while giving a presentation
    15·1 answer
  • Jacob is a teacher and wants to sort his grades based on Test 1 and then on Test 2.
    14·2 answers
  • Which javascript method should you use if you want to specify a message string to appear on your web page as it loads?
    13·1 answer
  • A windows host sends a tcp segment with source port number 1200 and destination port number 25. the sending host is a(n) _______
    10·1 answer
  • When is Hytale coming out?<br><br><br> P.S it might be Mine-craft 2.0<br><br><br> :)
    7·1 answer
  • What is the name of the virus that appears to be a legitimate program?
    5·1 answer
  • Choose the HTML5 element below that is used to configure an area on a web page that can stand on its own and could potentially b
    5·1 answer
  • There are many apps that help find you cheaper gas. If the cost of a gallon of regular gas is $3 at one station and $3.50 at ano
    15·1 answer
  • What is an insertion point?
    6·1 answer
  • Can someone help me with python
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!