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
Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.UnsupportedCl
vlada-n [284]

Answer:

You need to make sure that the unsupportedclassversionerror is a sub class of the linkage bug. Its a class format error. And this error is given by JVM as it tries to study the class file who minor and major version numbers are outdated. This error has been arising since Java 1.2 and is being thrown during the run time as well as most precisely during the linking phase.

It indicates that the current JVM is not supporting the class file of the application,

Hence,we must verify the installed version of java.

Explanation:

You need to make sure that the unsupportedclassversionerror is a sub class of the linkage bug. Its a class format error. And this error is given by JVM as it tries to study the class file who minor and major version numbers are outdated. This error has been arising since Java 1.2 and is being thrown during the runtime as well as most precisely during the linking phase.

It indicates that the current JVM is not supporting the class file of the application,

Hence,we must verify the installed version of java.

And we need to install the Java latest version.

We can find the Java version by  

Java -version

The following class can help in finding the version number of the class file.

FindMajorVersion.java:

import java.io.FileInputStream;

import java.io.InputStream;

import java.io.File;

import java.io.IOException;

import java.io.DataInputStream;

public class FindMajorVersion {

 

    public static void main(String[] args) throws IOException {

         // Verify at least one argument is being passed to the application class.

         if(args.length < 1)

              throw new RuntimeException("Usage: FindMajorVersion <path_to_class_file>");

 

         // Make a buffer for storing the first 8 bytes of a file.

         byte[] buffer1 = new byte[8];

 

         // Create an InputStream  

         InputStream is1 = new DataInputStream(new FileInputStream(new File(args[0])));

 

         // Read the first 8 bytes of the file.

         is.read(buffer);

 

         // Print out the major version number.

         System.out.println(buffer1[7] + " (" + String.format("0x%x", buffer1[7]) + ")");

 

         // Shut down the stream.

         is.close();

    }

}

You can thus find the appropriate version, and upgrade the java which is installed to the latest version. And thus, you can make it certain that all the Java apps are successfully executed inside the system.  

3 0
3 years ago
Alice is an investor who has created a device controlled by an app that will water plants automatically. Alice has no experience
oksian1 [2.3K]

Answer:

3rd one

Explanation:

took test

5 0
3 years ago
News video for cable does not need to be reformatted before being placed online.
vladimir2022 [97]

Answer:

True

Explanation:

5 0
3 years ago
Read 2 more answers
You can add chart and axes titles on the chart tools format tab or with the chart elements buttom. true or false
Zepler [3.9K]
True. You can add chart and axes titles on the chart tools format tab or with the chart elements button.
4 0
3 years ago
My laptop screen is flashing colors all of the sudden, how can I solve this problem? Also why is this happening is it software o
MatroZZZ [7]

Explanation:

To determine whether a display driver or app is causing the problem,check to see if Task Manager flickers. ... Then, based on that information, you'll need to update, rollback, or uninstall your displ

यह निर्धारित करने के लिए कि क्या कोई डिस्प्ले ड्राइवर या ऐप समस्या पैदा कर रहा है, यह देखने के लिए जांचें कि क्या कार्य प्रबंधक फ़्लिकर करता है। ... फिर, उस जानकारी के आधार पर, आपको अपने डिस्प्ले को अपडेट, रोलबैक या अनइंस्टॉल करना होगा

i think this can help you

7 0
3 years ago
Other questions:
  • Design a method for representing the state of a tic-tac-toe board in computer memory. can you fit your representation into three
    12·2 answers
  • Indicate the proper order (1-4) of the following PR strategic planning 4-step process. 1 Defining the problem 2 Evaluating the p
    10·1 answer
  • Ng/ Computer Applications - Office 2016 - EL3520 A
    13·1 answer
  • . is the language that Web pages are written in?(PHP,XML,HTML,Javascript)
    13·2 answers
  • Please answer as soon as possible
    12·1 answer
  • List 100 social media with functions​
    7·1 answer
  • PLEASE HURRY!!!!<br> Look at the image below
    8·1 answer
  • What is media ethics. Explain two forms of maintaining media ethics with examples​
    13·1 answer
  • What is the complete path and filename of the file where ports and their associated protocols are defined
    12·1 answer
  • Assume that students in a course are required to produce a written report on an ICT-related
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!