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 is a written or electronic document that outlines etiquette policies for using networks and network resources?
daser333 [38]

Acceptable Use Policy is a written or electronic document that outlines etiquette policies for using networks and network resources.

Therefore, the answer is Acceptable Use Policy.

3 0
3 years ago
Software that controls a computer. an os controls how system resources are used and provides a user interface, a way of managing
nataly862011 [7]
For bad software, probably a virus/malware/ransomware kind of thing. If it is good software, probably a program that organizes your files, adjusts certain things, but do not record your files (no programs are at the top of my head, sorry).
4 0
3 years ago
I need Help!!<br> 4. Explain the importance of including negative space as part of a design.
vova2212 [387]
Negative space is the space between, within and surrounding an object in an image. The positive space is the focus of the image, the object itself, but the negative space is just as important. It shares edges with the positive space, defining the outline of the object and creating proportion
5 0
3 years ago
In this lesson you wrote code to make the turtle draw squares. Briefly describe how the code for
ale4655 [162]

Explanation:

that programming language you must use?

3 0
3 years ago
Sharon is thinking about opening a bakery. She knows she wants to set her own hours, reduce her stress and make a profit. But sh
kondaur [170]
C would not be a beginner move.

hope it helps
6 0
3 years ago
Other questions:
  • An excel user should use a relative cell reference when it is important to ____. preserve the relationship to the formula locati
    7·1 answer
  • The first screen you see when you open word2016 what is called?​
    5·2 answers
  • Explain the distinction between interpretation and compilation. What are the comparative advantages and disadvantages of the two
    11·1 answer
  • What does the merge &amp; center button in the alignment group on the home tab do?
    8·1 answer
  • Which term describes the situation wherein a jury fails to reach a unanimous verdict? A occurs when a jury cannot reach a unanim
    14·1 answer
  • What are the four common tags used on webpages?
    11·1 answer
  • A town government is designing a new bus system. The planners are deciding where to put the different bus stops. They want to pi
    6·2 answers
  • I connected to an external hard drive to transfer some photos from my vacation. When I try to drag the photo, it bounces right b
    14·1 answer
  • Which of the following database object hold data?
    13·2 answers
  • Apply the Fill - Teal, Accent 4, Soft Bevel text effect (the 5th
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!