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
Nesterboy [21]
3 years ago
11

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

t it returns the average length of the strings in the list. An empty list should have an average of zero. Hint: don't forget that in order to get a string's length, you need the len function.
Computers and Technology
1 answer:
tester [92]3 years ago
6 0

Answer:

def average_strings(lst):

   total_length = 0

   avg = 0

   for s in lst:

       total_length += len(s)

   avg = total_length/len(lst)

   return avg

Explanation:

Create a function called average_strings that takes one parameter, lst

Initialize the total length and avg variables

Create a for loop that iterates through the lst. Get each string's length and put it to the total length

When the loop is done, calculate the average, divide total length by length of the lst

Return the average

You might be interested in
If I could make a Short Film on any topic it would be...how could that film change the world?
tensa zangetsu [6.8K]
Your Decision but a good one will be exploring the ocean or the underground it will be very shocking if you find something no one ever has found.
6 0
3 years ago
Describe 2 health risks posed by computers
iogann1982 [59]

Answer:

Bad posture and eye strain are two health risks posed by computers. Hand and wrist problems are other health risks posed by computers.

4 0
3 years ago
If all of Earth's history were squeezed into one 12-hour period, how long ago did Precambrian time end? How long did the Cenozoi
Jet001 [13]

Answer:

That it

Explanation:

There have been mass extinctions during the Cenozoic as there were during the Mesozoic and Paleozoic, but not as many animals and plants have disappeared. Finally, humanity appeared during the last two million years.The human lineage only diverged from our most recent common ancestor about 5 million years ago; less than half of 1% of that time, and modern Homo sapiens is only between 200,000 and 50,000 years old, depending on your definition.

7 0
3 years ago
Categories of functions specified by computer instruction?
Lelu [443]
Is this for a test, because someone else asked that.
4 0
3 years ago
Answer this blank:<br><br> Air enters through the mouth or nose, and travels through the _
Schach [20]
Respiratory system ?. Or esophagus?
5 0
3 years ago
Read 2 more answers
Other questions:
  • 2. You have classes to represent different shapes (see below). You realize you can benefit from inheritance and polymorphism by
    13·1 answer
  • The acceleration of a body is 3 metre per second square what does it mean​
    11·2 answers
  • (Financial application: compound value) Suppose you save $100 each month into a savings account with the annual interest rate 5%
    8·1 answer
  • What are some good electronics that I can buy on Amazon?
    14·1 answer
  • Write a program with total change amount as an integer input, and output the change using the fewest coins, one coin type per li
    11·1 answer
  • Run the browser checker to see that the computer you are using now is set up for WileyPLUS. Which of the following browser funct
    15·1 answer
  • Create a program that finds (n+1)! -factorial- of an integer n in C++.
    13·1 answer
  • The image below shows an encoding for a black and white pixel image. The first two
    13·1 answer
  • Plzz help me with this question.........
    6·1 answer
  • Frank enters "1" in the field for postal code. What is frank most likely trying to do?
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!