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
inessss [21]
3 years ago
12

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.student.py HNM 1 - Hef filter_only_certain_strings (data_list): new_list = [] for data in data_list: if type (data) == str and len(data) >= 5: new_list.append(data) return new_list Restore original file Save & Grade Save only
Computers and Technology
1 answer:
Nataliya [291]3 years ago
6 0

Answer:

Explanation:

The Python code that is provided in the question is correct just badly formatted. The snippet of code that states

return new_list

is badly indented and is being accidentally called inside the if statement. This is causing the function to end right after the first element on the list regardless of what type of data it is. In order for the code to work this line needs have the indentation removed so that it lines up with the for loop. like so... and you can see the correct output in the attached picture below.

def filter_only_certain_strings(data_list):

   new_list = []

   for data in data_list:

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

           new_list.append(data)

   return new_list

You might be interested in
What is a client server network and its features?​
maks197457 [2]

Answer:

A client-server network is the medium through which clients access resources and services from a central computer, via either a local area network (LAN) or a wide-area network (WAN), such as the Internet. ... A major advantage of the client-server network is the central management of applications and data.

8 0
3 years ago
Can you choose what part of the image is in focus with a point-and-shoot camera?
Evgen [1.6K]

I believe you can blur the background of the image you are taking of.

6 0
3 years ago
Please help me to do this task
natima [27]

INPUT Num

While Counter > 12

       Num Num * Counter

       A[Counter] Num

End While

5 0
4 years ago
Run the browser checker to see that the computer you are using now is set up for WileyPLUS. Which of the following browser funct
True [87]

Answer:

Mobile View

Explanation:

WileyPLUS is a web-based application that assists instructors in preparing for classes and lectures and automates the process of assigning and grading homework. It allows students to access the WileyPLUS course material and complete their homework online and receive instant feedback on their work.

WileyPLUS system requirements:

System Hardware:

<em>PC: Pentium IV or better with 256MB of RAM (minimum 256MB of RAM) </em>

<em>Mac: G4 Processor 733MHz or better with 512MB of RAM (minimum 128MB of </em>

<em>RAM) </em>

Operating Systems:

<em>PC: Windows 98 / 2000 / ME / XP </em>

<em>Mac: OS X (minimum of 10.2.8; 10.3.1 or better is recommended) </em>

Browsers:

<em>PC: Internet Explorer v6.0 or better;</em>

<em>Mozilla FireFox 1.0 or better</em>

<em>Mac: Safari 1.3 or better </em>

4 0
3 years ago
What is the best programming language
pashok25 [27]

Answer:

Ther are 8 best programming language :

• Javascript

• Swift

• Scala

• Go

• Python

• Elm

• Ruby

• C#

4 0
3 years ago
Other questions:
  • Which statement about information published on the internet is true?
    9·2 answers
  • Bugs bunny personality traits
    7·1 answer
  • If an appliance consumes 500 W of power and is left on for 5 hours, how much energy is used over this time period?
    5·1 answer
  • Each of the following programs has errors. Find as many as you can. 65. // Find the error in this program. #include using namesp
    5·1 answer
  • How are people using lying today? What are the types of lying? Describe each type.
    7·1 answer
  • Which of these can be considered data ?
    6·2 answers
  • In this project you will write a set of instructions (algorithm). The two grids below have colored boxes in different
    9·2 answers
  • Why is dark supereffective against ghost? (AGAIN)
    8·1 answer
  • Assume that two students are trying to register for a course in which there is only one open seat. What component of a database
    12·2 answers
  • 9. Which of the following will best protect your computer from viruses and hackers?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!