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]
2 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]2 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 stores all software and files on your computer and reads and writes data onto a spinning magnetic or optical disk?
stiv31 [10]

Answer:

Depends. could be an external opticial drive, a scuzi drive, a real to real tape system, or just a simple electromagnetic hard drive with speeds of 1000 rpm or more

8 0
3 years ago
. When would one use the analytic application fraud detection?
vaieri [72.5K]

Answer:Fraud detection through analytical method is used for detection of the fraud transactions,bribe activity etc in companies, business,etc. This techniques helps in the reduction of financial frauds in the organization, have the control over company to protect it,decrease in the fraud associated costs etc.

It has the capability of identifying the fraud which has happened or going to happen through the analytical ways and human interference. The organizations or companies require efficient processing and detection system for identification of such false happening.

4 0
3 years ago
How can you troubleshoot Internet access problems?
joja [24]

Answer:

Check the network icon (or wireless connection settings) to see if you have Internet access. ...

Check for changes to proxy settings.

Check the network cables if your computer is wired to the router.

Reset your router.

Check your firewall or security software.

Hopefully this helps.

8 0
3 years ago
What wired channel, commonly used for cable tv, consists of an insulated copper wire wrapped in a solid or braided shield placed
Airida [17]
the answer is A coaxial cable
8 0
3 years ago
What can Strings store
horsena [70]
A string is generally considered as a data type and is often implemented as an array data structure of bytes (or words) that stores a sequence of elements, typically characters, using some character encoding. String may also denote more general arrays or other sequence (or list) data types and structures.
5 0
3 years ago
Read 2 more answers
Other questions:
  • . Reorder the following efficiencies from smallest to largest:
    9·1 answer
  • By which method is heat transferred through a metal <br> spoon?
    9·2 answers
  • Pls help me!!!!!!!!!!!!!
    5·2 answers
  • If Chris has a car liability insurance, what damage would he be covered for
    10·1 answer
  • Using this tool to help you to visualize your slides and develop your content
    13·1 answer
  • To connect a peripheral device to a computer to exchange data, find the appropriate ________ for the device.
    7·1 answer
  • Which option is referred to by the Reports Due tag?
    7·1 answer
  • What is a mod in programming?<br><br> Give more Java questions
    12·1 answer
  • Jill is configuring the AutoArchive feature in Outlook 2016. What is the default setting in relation to when AutoArchive
    8·1 answer
  • The most widely used computer device​
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!