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]
2 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]2 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
Whoever wants to join me in The Sims (mobile), my friend code is:<br> EPQL3E9<br> Come join me!
BigorU [14]
BET LOLOLOL SEE YA THERE
7 0
2 years ago
Read 2 more answers
What is the primary way to access applications in window 10
Alex787 [66]

Choose Start, type the name of the application, like Word or Excel, in the Search programs and files box. In the search results, click the application to start it. Choose Start > All Programs to see a list of all your applications. You might need to scroll down to see the Microsoft Office group.

8 0
3 years ago
Being able to express your thoughts in an email is a primary technology skill. true or false.
Zina [86]

almost everywhere else I've found this question the answer was false so i hope that helps.

5 0
2 years ago
Read 2 more answers
Please draw a diagram of a complete graph with 5 vertices (K5), its adjacency matrix and adjacency list representations.
Artist 52 [7]

Answer:

Please check the attachment.

Explanation:

The adjacency matrix is the matrix that has nodes as rows and columns. The nodes if connected is stated as 1 or else 0. And the adjacency list representation is the list with nodes and connected nodes. The nodes that are not connected are not being listed. The diagram and list as well as matrix can be found in the attachment.

4 0
3 years ago
2
Elza [17]

A is the correct answer.

Hope this helps you!

3 0
3 years ago
Read 2 more answers
Other questions:
  • In doing a load of clothes, a clothes drier uses 18 A of current at 240 V for 59 min. A personal computer, in contrast, uses 3.0
    7·1 answer
  • Erick, who is taking an online course, sent an e-mail to his
    14·2 answers
  • Need help this will affect my final grade in technology and the dead line has passed!!!
    11·1 answer
  • When you park on a hill, think about which way _____.
    6·2 answers
  • What is a benefit of the Name Manager feature?​
    12·2 answers
  • Please answer this correctly what’s the answer opening modify style dialog box enables you to
    8·1 answer
  • Assuming 8-bit 2's complement notation, what is the result of subtracting 00001001 from 00001101?
    11·1 answer
  • Can I get the code for the Edhesive Assignment 3 Chatbox in python? Thanks.
    15·1 answer
  • Jamal wants to create a program that will play music during the afternoon. Which kind of loop should be used in the program?
    6·2 answers
  • Cloud architects have been largely replaced by ScrumMasters.<br><br> True<br><br> False
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!