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]
2 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]2 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 term describes data actions being performed by endpoint devices, such as printing a report from a desktop computer?
Sloan [31]

Answer:

The correct answer to the following question will be "Data-in-use".

Explanation:

  • Data-in-use is an IT term referring to active information that is usually preserved in a semi-persistent physical state in RAM of computer, CPU registers or caches.
  • It might be created, modified or changed, deleted or accessed via different endpoints of the interface. This is indeed a useful term for IT departments to pursue institutional defense.

Therefore, it's the right answer.

4 0
2 years ago
Now you are ready to implement a spell checker by using or quadratic. Given a document, your program should output all of the co
Harlamova29_29 [7]

Answer:

Sorry po idont know po ehhh sorry

5 0
2 years ago
The _________ contains frequently used formatting commands that are displayed when selecting text or objects with the mouse.
kolbaska11 [484]
The Answer is toolbar.
<span>The mini or small toolbar contains frequently used formatting commands that are displayed when selecting text or objects with the mouse.
Toolbar is also known as Ribbon. It is present in computer interface design. We can see toolbar in many softwares like Microsoft office suite, web explorer, designing softwares etc. it is mostly present under the menu bar and it has many options.</span>
3 0
3 years ago
16.50. Suppose we have a sequential (ordered) file of 100,000 records where each record is 240 bytes. Assume that B = 2,400 byte
Nat2105 [25]

Answer and Explanation:

Given that total number of records in a file = 100000

Each record consists of= 240 bytes

Given that B= 2400 bytes.

Then total blocks in file = 100000 records * 240 / 2400

= 10000 blocks.

Time that will take for exhaustive read

= s + r + b.btt

= 16 + 8.3 + (10000) * 0.8

= 8024.3 msec

Now as per given X be the number of records that are searched randomly and it takes more than exhaustive read time.

Hence, X (s + r + btt) > 8024.3

X (16+8.3+0.8) > 8024.3

X > 8024.3/25.1

So that, X > 319.69

Hence, atleast 320 random reads should be made to search the file

8 0
3 years ago
Which of these inventions was necessary to permit magnetic recording?
eimsori [14]
It’s C vinyl records permit magnetic fields
4 0
3 years ago
Read 2 more answers
Other questions:
  • whats something that u want to do but ur parents wont allow it like having a phone or going to a college ​
    11·2 answers
  • Ascending and descending are examples of
    5·2 answers
  • A cell in a spreadsheet can contain _________?
    12·1 answer
  • What lie does E.D. tell to keep the musical from being canceled? There is a television crew coming to do a story on it. Jake wil
    6·1 answer
  • Why is there more content on youtube in 4k then there is on cable, satellite, and digital tv combined?
    6·2 answers
  • Based on your research and understanding, write a 3- to 4-page Microsoft Word document that:
    11·1 answer
  • ap csp The local, remote, and upstream _______ can each have multiple ___ _____. When a participant in a collaborative group on
    5·1 answer
  • What does XD mean? I keep seeing people say it and I dont know what it means
    6·2 answers
  • Help plz, u just gotta select all that apply :)
    15·1 answer
  • Challenge activity 1.11.1: using constant in expression is not working for me. Can any one help me find the right code?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!