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
allochka39001 [22]
3 years ago
6

The function below takes a single argument: data_list, a list containing a mix of strings and numbers. The function tries to use

the Filter pattern to filter the list in order to return a new list which contains only strings longer than five characters. The current implementation breaks when it encounters integers in the list. Fix it to return a properly filtered new list.
Computers and Technology
1 answer:
Doss [256]3 years ago
6 0

Answer:

def filter_strings(data_list):

   string_list = []

   for s in data_list:

       if type(s) == str and len(s) > 5:

           string_list.append(s)

   return string_list

Explanation:

Create a function called filter_strings that takes data_list as a parameter

Initialize a new list to hold the strings that are longer than 5 characters

Initialize a for loop that iterates through the data_list

Check the elements if they are string - use type function, and if their length is greater than 5 - use len function. If an element satisfies the both conditions, put it to the string_list

When the loop is done, return the string_list

You might be interested in
There are 4 fruits apples,oranges,bananas and grapes. Each student can pick up 2 fruits.There are some conditions which have to
bekas [8.4K]

Answer:

start→ randomly pick a fruit from the list→ if the first fruit is 'apple', pick 'banana', else if 'orange', pick 'grape', else if 'grape', pick 'banana'→ print second fruit→end.

Explanation:

To pick a second fruit, some conditions have to be met,

  • if you pick an apple, the second fruit should be a banana.
  • if you pick an orange, the second fruit should be a grape.
  • if you pick a grape, the second fruit should be a banana.

4 0
3 years ago
Why might you receive a tax refund from the irs
Harrizon [31]
Im not quite sure but i got mine back yesterday soooo (pretty good)

8 0
4 years ago
Match these step-by-step directions in the order that you will find them in this course.
7nadin3 [17]

Answer:

1.Go to the View tab and select Watch.

2.Comparison

3.Editing

4.Drawing (I think)

5.Predesigned slides available for creating a new presentation

Explanation:

6 0
3 years ago
A team of researchers wants to create a program to analyze the amount of pollution reported in roughly 3,000 counties across the
omeli [17]

The option that is most likely to be a challenge in creating the program is Different counties may organize data in different ways.

<h3>What is Pollution?</h3>

Pollution is known to be a kind of bringing in of harmful materials into an environment.

These harmful things are known as pollutants. Pollutants are known to be natural and artificial that is they are created by human activity, such as trash or runoff produced by factories, etc.

Learn more program from

brainly.com/question/1538272

7 0
2 years ago
Clickable text or image that takes you to a different site
hichkok12 [17]
A clickable text or image that takes you to a different site is called a Hyperlink or simply a Link.
3 0
3 years ago
Other questions:
  • A pages visual organization is known as the
    14·2 answers
  • A business wants to centralize its administrative tasks. At the same time, it wants the existing systems to manage and sustain t
    14·2 answers
  • Assume that the vector arr has been declared. In addition, assume that VECTOR_SIZE has been defined to be an integer that equals
    10·1 answer
  • What is an entity? An attribute?
    13·1 answer
  • Which is an internet service? <br> A.) antivirus <br> B.) chat <br> C.) firewall<br> D.) router
    6·2 answers
  • Now you are ready to implement a spell checker by using or quadratic. Given a document, your program should output all of the co
    15·1 answer
  • WILL MARK BRIAN PLZ HELP PLZ I BEG YOU While levels often change in order to give a game some more variability, they might also
    11·1 answer
  • What adaptation Judy and her parents have that help them run from predators coming?​
    6·1 answer
  • What would a programmer use to stop a while-looping sequence and return to the beginning of the statement?
    11·2 answers
  • Write a program to
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!