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
WNOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOW
beks73 [17]

Answer:

yes.

Explanation:

7 0
3 years ago
What file holds the preferences and settings of the currently signed-in user??
VashaNatasha [74]
The answer to the question above is ntuser.dat. This is actually a registry file that contains the registry information of the user or account. According to Windows, this is known to be as the <span>"central hierarchical database" as this contains relevant information of the user such as profiles, and both of its hardware and software.</span>
3 0
3 years ago
Why is it a mistake to put e-mail address of people who don't know each other in the "to:" field
Ber [7]
They would probably think that you sent the email to the wrong person and then delete it.
7 0
4 years ago
Read 2 more answers
When using a direct quotation, which one of the following is not necessary?
ss7ja [257]

Answer:

B

Explanation:

You can't rewrite a source with the writers voice. that makes no sense

6 0
4 years ago
write an algorithm and draw a flowchart for switching off a machine after it has made 500 glass bottles. use an appropriate cond
Anni [7]

Answer:

The algorithm is as follows:

1. Start

2. bottles = 0

3. While bottles != 500

  3.1 Create bottle

  3.2 bottle = bottle + 1

4. Switch off machine

5. Stop

<em>See attachment for flowchart</em>

Explanation:

This begins the algorithm

1. Start

This initializes bottles to 0

2. bottles = 0

The loop is repeated until 500 bottles is created

3. While bottles != 500

This creates a new bottle

  3.1 Create bottle

This increments the number of bottles by 1

  3.2 bottle = bottle + 1

This switches of the machine after all bottles are created

4. Switch off machine

End algorithm

5. Stop

<em></em>

<em></em>

7 0
3 years ago
Other questions:
  • Which of the following best defines natural selection?
    8·1 answer
  • Which references are updated when you copy the formula =$E6-MAX(H$1:J4)
    10·1 answer
  • The media is a phase that people often use to refer to:
    6·1 answer
  • A printer is connected locally on Computer1 and is shared on the network. Computer2 installs the shared printer and connects to
    10·1 answer
  • As an IT tech for your company, you have been notified that the Windows domain does not seem to be functioning properly. Being f
    7·1 answer
  • What does XD mean? I keep seeing people say it and I dont know what it means
    6·2 answers
  • pLZ PLZ PLZ HELP I HAVE SO MANY MISSING ASSINMENTS. why is physical security so important and necessary for both personal users
    8·1 answer
  • Suppose the size of process is 10000 bytes and the relocation register is loaded with value 5000 which of the following memory a
    15·1 answer
  • Which statement best describes a social impact of computing on the world?
    9·1 answer
  • You're asked to recommend potential data structures to use as the backing for implementing Kruskal's algorithm. Which of the fol
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!