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]
4 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]4 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]4 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
To copy cell contents, you can select the cell and then press the ____ keys.
LenaWriter [7]
To copy cell contents, you can select the cell and then press the CTRL + C keys. 
They act as a sort of a shortcut, so you don't have to select, right click and then choose copy. 
8 0
4 years ago
8. Suppose you've created a bulleted list, but the bullets are too close to the text. What is the best way to fix this?
Juliette [100K]

To fix a bulleted list that are too close to the text, you need to add space using the space key on your keyboard or adjust the indentation bullets on the ruler.

<h3 /><h3>How to add spacing in MS Word?</h3>

To format a bulleted list in this software, it is necessary to use the context menu by clicking with the right mouse button and displaying the List Paragraph dialog box, located in the styles panel, which makes it possible to adjust and apply the ideal spacing.

Therefore, you can use additional formatting on List Paragraph and adjust your work to your preferences.

Find out more information about MS Word here:

brainly.com/question/1538272

5 0
3 years ago
#include
meriva

Answer:

wait what

Explanation:

6 0
2 years ago
Read 2 more answers
What would the internet be like today if there was no World Wide Web?
Anvisha [2.4K]

Answer:

Non existent probably

Explanation:

3 0
3 years ago
Open design would seem to favor the attacker, because it certainly opens the implementation and perhaps also the design for the
Naddika [18.5K]

Answer:

Explanation:

Open  design  allows  for  much  closer  inspection  of  the  security  system—more  awareness  of  the  security  practices  in  place  is  more  likely  to  reveal  vulnerabilities  to  enable  resolving  those  vulnerabilities  rather  than  their  exploitation.  Obscurity  is  an  insufficient  security  mechanism,  open  design  allows  a  more  thorough  inspection,  and  knowing  that  a  design  will  be  open  should  make  designers  more  careful

4 0
3 years ago
Other questions:
  • Question 1 : Which statement is true about interlaced images? This task contains the radio buttons and checkboxes for options. T
    8·1 answer
  • Which statement is a good reason for backing up your data to the cloud?
    7·2 answers
  • Which of the following enabled mass production in the 1920s? a.standardization of spare parts b.mass availability of electricity
    7·2 answers
  • Create a view named ItemOrder view. It consists of the TaskID, description, price, order number, order date, and quoted price fo
    8·1 answer
  • Which command displays the status of the ipsec installation?
    7·1 answer
  • True or False
    13·1 answer
  • In object-oriented programming, the object encapsulates both the data and the functions that operate on the data.
    10·1 answer
  • Which statement about muzzleloaders is true? All muzzleloaders are rifles. All muzzleloaders have only one barrel. Muzzleloaders
    12·1 answer
  • Puter Science (IS)
    14·1 answer
  • Which of these sentences correctly shows how youngsters use the Internet?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!