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
Your task is to create a bash shell script that is able to backup all the C++ program files in your current directory. The algor
Oliga [24]

Answer:

backup() {

 read dirname;

 if [[ whereis . /`$dirname` 2>  sterr.exe]]  

    then

        mkdir  $dirname

 for f in . / *.cpp

 do

    cp f "path_to_dirname"

    echo "file backup complete"

}

backup( )

Explanation:

The bash script above is used to backup C++ source files in a directory to a backup directory which is created if it does not exist, and copy's each .cpp file to backup, then sends a message to declare its completion.

7 0
3 years ago
To change the backround color of a page, which tab would you use?
ivann1987 [24]
I have concluded the answer is a
4 0
3 years ago
Read 2 more answers
Select the four tactics that cyber criminals use for stealing information from the list below.
Snowcat [4.5K]
Baiting clickjacking pharming spamming
6 0
2 years ago
Describe two differences between landscape mode and portrait mode. Respond in 2-3 complete sentences.
Mice21 [21]

Answer:

they just are different

Explanation:

3 0
3 years ago
Read 2 more answers
:)
Vilka [71]

Answer:

A, system software

Explanation:

that is answer an interpreter is a type of system software

5 0
3 years ago
Other questions:
  • what tool can a student use to make sure his or her work paper does not take credit for someone else's work ?
    5·1 answer
  • Software that gives network administrators the ability to provide computer assistance from a central location by allowing them t
    15·1 answer
  • Which of the following software maintenance steps erases gaps caused by deleting files from the hard drive?
    10·1 answer
  • A ________ algorithm is a method of locating a specific item of information in a larger collection of data.
    8·1 answer
  • All of the following are aspects of the search process except?
    6·2 answers
  • When looking at a relationship between two tables on an ERD, the _____ table can be identified by the presence of a foreign key
    8·1 answer
  • The default paper size is _____. <br> a. letter <br> b. legal <br> c. executive <br> d. statement
    7·1 answer
  • "What line of code can be used to provide a convenient way to merge the source code from one file with the source code in anothe
    8·1 answer
  • Which of the following is the best example of an installation issue?
    6·2 answers
  • Which information can you apply to every page of your document with the page layout options?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!