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
amm1812
3 years ago
14

Write a function called average() that takes a single parameter, a list of numeric values. The function should return the averag

e of the values in the list. If the list is empty, average() should return 0.
>>>lst = [1,3,4]

>>>average(lst)

2.6666666666666665

>>>average([])

0
Computers and Technology
1 answer:
QveST [7]3 years ago
3 0

Answer:

The following code is in python.

import statistics as st #importing statistics which include mean function.

def average(lst): #function average.

   return st.mean(lst)#returning mean.

lst=a = list(map(int,input("\nEnter the list : ").strip().split()))#taking input of the list..

print("The average is "+str(average(lst)))#printing the average.

Output:-

Enter the list :

1 2 3 4 5 6

The average is 3.5

Explanation:

I have used the statistics library which includes the mean function that calculates the mean or average of the list.In the function average having lst as an argument returns the mean of the list lst.

Then taking lst input from the user and printing it's average.

You might be interested in
What type of software is responsible for managing processor time and memory allocation?
yKpoI14uk [10]

Answer: Operating system

Explanation:

 The operating system is the type of software that are responsible for manage the processor time and also the memory allocation in the system. The operating system mainly deals with the processor time by scheduling the processor work done in the system.

The OS mainly control the system and then schedule the execution of various types of function by the central processing system (CPU). It also control the memory allocation in the system.

4 0
3 years ago
Drag each tile to the correct box.
garri49 [273]
I think select the video insert select the movie option under illustrations resize the video player then select the insert tab i’m not 100 percent sure tho
8 0
3 years ago
Read 2 more answers
Ses
jekas [21]

Answer:

Amoung us

Explanation:

When the imposter is sus

8 0
3 years ago
5. The coordinates of triangle ABC are A(-7, 3), B(3, -7) and C(8. 8)
kati45 [8]

Answer:

b

Explanation:

6 0
3 years ago
Read 2 more answers
Suppose that a CPU scheduling algorithm favors those processes that have used the least processor time in the recent past. Why w
avanturin [10]

Answer:

I/O bound programs will be favored due to the CPU burst request of the I/O programs. This is because their CPU burst request is short and would release the CPU within a short period.

Due to the brief request time of the I/O programs on the CPU, CPU-bound programs will not be permanently starved. After a little while, CPU resources will be released to the CPU-bound programs for use.

6 0
3 years ago
Other questions:
  • In Windows Vista, the Run command can be found in which application?
    6·1 answer
  • Based on your research and understanding, write a 3- to 4-page Microsoft Word document that:
    11·1 answer
  • Which of the following barriers to oral communication is not the fault of the sender or receiver? being unprepared noise not pay
    12·2 answers
  • 1000base-t is a standard for achieving throughputs ____ times faster than fast ethernet over copper cable.
    8·1 answer
  • The browser on which you are viewing web pages is called the
    13·1 answer
  • Including the word OR will make a search less specific.<br> O False<br> O True
    8·2 answers
  • 1 punto
    11·1 answer
  • Differentiate between tabular and column form layout​
    14·1 answer
  • Why we need to interpret the drawing and plans
    10·1 answer
  • Refer to the exhibit. Host B on subnet Teachers transmits a packet to host D on subnet Students. Which Layer 2 and Layer 3 addre
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!