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
_______ ______ is the creation of a computer program by utilizing pictorial elements. Question 36 options: A. Assembly Programmi
aniked [119]
I think it's C. Visual Programming 

but I'm not 100% sure
6 0
4 years ago
Read 2 more answers
The diagram shows the positions of the Sun, Earth, and Moon during each moon phase. When viewed from Earth, at what point does t
goldfiish [28.3K]

Answer:

B

Explanation:

when it is on the same side of Earth as the Sun because it appears all black because of the shadow

7 0
2 years ago
What is meant by saving a sheet document​
Zina [86]

Answer:

While you'll use Save or press Ctrl+S to save an existing workbook in its current location, you need to use Save As to save your workbook for the first time, in a different location, or to create a copy of your workbook in the same or another location.

5 0
3 years ago
The purpose of a function that does not return a value is
tatuchka [14]

Answer:

The answer to the given question is the option "a".

Explanation:

A function is a block of organized code that provides the reusability of the code. It is used to perform a separate, complex action. In programming languages name is different like, functions, methods, subroutines, procedures, etc. but the working of the function is the same. The purpose of the function that does not return a value is the option "a" and All the options are correct.  

5 0
3 years ago
Can someone help me on a 60 second ringtone :(
Lesechka [4]

Answer:

If you have an apple phone, its as easy as importing it into Garage Band, cutting it to size, and exporting it as a ringtone or even a text tone. My text tone is now Megalovania.

5 0
3 years ago
Other questions:
  • Which statement is true
    12·1 answer
  • Flesh out the body of the print_seconds function so that it prints the total amount of seconds given the hours, minutes, and sec
    12·1 answer
  • What the heck is a motherboard and why is my computer not working when i take it out
    14·1 answer
  • Annalise received financial aid offers from two universities. Financial Analysis for Option A Costs per Year Financial Aid Packa
    8·2 answers
  • Susan's monthly goal to open five new customer
    10·1 answer
  • Which of the following is NOT an e-reader you would use as an alternative to carrying around a set of textbooks?
    13·1 answer
  • Third party providers of publicly available data sets protect the anonymity of the individuals in the data set primarily by a. R
    6·1 answer
  • A company's desire to sell products and services: A. will ultimately lead to its doom. B. explains why the web took off C. can d
    9·2 answers
  • Have you heard about Gold Opinions?<br><br> It is a new product that just came out.
    6·1 answer
  • Need some help writing a simple PYTHON Student registration program:
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!