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
nataly862011 [7]
3 years ago
5

he function below takes one parameter: a list of strings (string_list). Complete the function to return a new list containing on

ly the strings from the original list that are less than 20 characters long.
Computers and Technology
2 answers:
Aleks04 [339]3 years ago
4 0

Answer:

def select_short_strings(string_list):

   new_list = []

   

   for s in string_list:

       if len(s) < 20:

           new_list.append(s)

   return new_list

   

lst = ["apple", "I am learning Python and it is fun!", "I love programming, it is easy", "orange"]

print(select_short_strings(lst))

Explanation:

- Create a function called <em>select_short_strings</em> that takes one argument <em>string_list</em>

Inside the function:

- Initialize an empty list to hold the strings that are less than 20

- Inside the loop, check the strings inside <em>string_list</em> has a length that is smaller than 20. If found one, put it to the <em>new_list</em>.

- When the loop is done, return the <em>new_list</em>

- Create a list to check and call the function

3241004551 [841]3 years ago
3 0

Answer:

# the solution function is defined

# it takes a list as parameter

def solution(string_list):

# an empty new list is initialized

new_list = []

# a loop that loop through the splitted_list

# it checks if the length of each string is less than 20

# if it is less than 20

# it is attached to the new list

for each_string in string_list:

if(len(each_string) < 20):

new_list.append(each_string)

# the new list is printed

print(new_list)

# the function is called with a sample list

solution(["The", "player", "determined", "never", "compromised"])

Explanation:

The program is written in Python and it is well commented.

You might be interested in
Orifice tubes are A. coded in American models only. B. coded by number for easy identification. C. similarly but not exactly siz
timurjin [86]
I'd go for (C) similarly but not exactly sized

Basically, to explain an orifice tube in Layman’s context, it is a car’s air conditioning system and is the exact place where the cold happens. Not all orifice tubes are standard sized and this means that different model vehicles use different sizes. These tubes are often color-coded for easy identification.






8 0
2 years ago
It is important to use as much text as possible in a presentation. <br> a. True<br> b. False
Kryger [21]
False. You should have little text and lots of pictures, because you are the one who should be doing the explaining, not the presentation.
4 0
2 years ago
Direct messages are the only private forms of communication on Twitter. True False
Sunny_sXe [5.5K]
True but ill keep typing so it meets twenty charecters                                              

7 0
3 years ago
[name] was planning a dream vacation to [place].
Gwar [14]
Alexis was planning a dream vacation to Spain.

Alexis/She was especially looking forward to trying the local cuisine, including the famous Paella and Churros.

Alexis will have to practice the language
frequently to make it easier to speak with people.

Alexis/She has a long list of sights to see, including the El Prado museum and the beautiful park.


Hope this helps :)
5 0
3 years ago
Which characteristics describe the WMV video file format? Choose all that apply.
Lelechka [254]

Answer:

the answer is A, B, C hope this helps.

8 0
2 years ago
Other questions:
  • Exposing employee and customer personal data to an untrusted environment is an example of:
    9·1 answer
  • Which layer of the osi model defines functions related to data delivery, error recovery, and flow control?
    8·1 answer
  • A motherboard uses dual channeling, but you have four DIMMs available that differ in size. The motherboard supports all four siz
    7·1 answer
  • Unit testing:_________. A. provides the final certification that the system is ready to be used in a production setting. B. incl
    8·1 answer
  • Match each task with the features necessary to complete the task
    10·1 answer
  • An example of an electrical insulator is _____.
    15·1 answer
  • Always follow the routine "clean up while in use and clean up before keeping it".
    6·1 answer
  • HELP PLEASE!!!! Which type of prototyping is most often associated with the rapid prototyping development method?
    11·1 answer
  • Einstein's famous equation states that the energy in an object at rest equals its mass times the squar of the speed of light. (T
    6·1 answer
  • Continue your S3 and S4 assignment for a young soccer league with the following specification. Do not include the previous queri
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!