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
Anna71 [15]
3 years ago
4

Define a function below called average numbers. The function takes one argument: a list of numbers. Complete the function so tha

t it returns the average of the list of numbers. An empty list should have an average of zero.
Computers and Technology
1 answer:
Aleonysh [2.5K]3 years ago
4 0

Answer:

def average_numbers(lst):

   if len(lst) == 0:

       return 0

   else:

       total = 0

       for number in lst:

           total += number

       return total / len(lst)

Explanation:

Create a function called average_numbers that takes one parameter, lst

If the lst is empty, return 0.

Otherwise, add the numbers in the lst to the total using a for loop. When the loop is done, calculate and return the average, divide sum by length of the lst to calculate the average

You might be interested in
Name and define (or list the set that defines) three of the four common data types in programming
aliina [53]

In Computer programming, there are four (4) common data types and these include:

  1. Integer type (int):
  2. Floating point type (float)
  3. Boolean (bool)
  4. String (str)

<h3>The kinds of data type.</h3>

In Computer programming, there are four (4) common data types and these include:

  • <u>Integer type (int):</u> it is used for storing whole numbers such as 1, 2, 3, 4, ..... 2,147,483,647.

  • <u>Floating point type (float):</u> it is used for defining real numbers that have a decimal point such as 0.009, 9.87, 5.6, etc.

  • <u>Boolean (bool):</u> it allow users to combine keywords with Boolean operators (quotes, AND, OR, near/n) as either true or false.

  • <u>String (str):</u> it is used for data values that are made up of ordered sequences of characters.

Read more on a data types here: brainly.com/question/25619349

3 0
2 years ago
Which type of topology describes the physical arrangement, installation, and connection of cables, computer, and other devices?
Nutka1998 [239]
<span>The network topology describes the physical arrangement, installation, and connection of cables, computer, and other devices.
The network topology can be bus topology (a</span><span> network topology that uses a single cable or conductor to connect all nodes on the network.) ,</span>star topology (a network topology in which cables running from each node connect to a single point, such as a hub.), ring (a network topology that consists of a single cable that runs continuously from node to node), mesh, hybrid, hub topology,... according the arrangement of the nodes. 

8 0
3 years ago
Read 2 more answers
What is the difference between the web and the internet?
Naddika [18.5K]
The Web is just one of the ways that information can be disseminated over the Internet
4 0
3 years ago
What do character formats do for your document's message??
IrinaK [193]
Character formats allow for the easy reading and identification of important points in a document's message. Character formats in a document is like typography in posters. The attention of the readers are drawn towards which parts are important.
6 0
3 years ago
Read 2 more answers
In c++ 11, the ________ tells the compiler to determine the variable's data type from the initialization value.
sergiy2304 [10]
<span>In describing an Initialization is when a value is assigned to a variable as part of the variable's definition or the assinged values to variables are defined whenever. 

The best answer would be is that they present the keyword,  when they tell the compiler.</span>
3 0
4 years ago
Other questions:
  • Which is the last step in conducting a url research
    11·1 answer
  • I need help answering these questions!
    11·1 answer
  • The function below takes a string argument sentence. Complete the function to return the second word of the sentence. You can as
    5·1 answer
  • It is an attribute that must be used in the form tag in specifying an input file type
    9·1 answer
  • Describe the positive and negative effects of Internet​
    6·2 answers
  • How does recorded audio stay on an audio tape
    12·1 answer
  • What can hack or code can I use to get a shadow or frost dragon in adopt me
    6·2 answers
  • If any one answered this i will give brilientst what is stimulation program​
    6·1 answer
  • 1. Who was the first lady programmer?​
    14·2 answers
  • Dragging a mouse over text is called
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!