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
SVETLANKA909090 [29]
3 years ago
11

Define a function below, filter_only_strs, which takes a single argument of type list. Complete the function so that it returns

a list that contains only the strings from the original list and no other data. It is acceptable to return an empty list if there are no strings in the original list.
def filter_only_strs(1st):
for x in lst:
if isinstance(x,str)==False:
lst.remove(x)
return ist Restore original file
Computers and Technology
1 answer:
lesya [120]3 years ago
4 0

Answer:

Explanation:

The code provided aside from some minor errors (fixed version down below) is correct, but it will never be able to accomplish what is being asked in the question. This is because this code is simply copying and returning the exact same list that is passed as an argument, because it is looping through it and comparing its own elements. In order to accomplish what is asked in the question, two lists need to be passed as parameters. The first would be the original list, and the second would be a list of test elements that will be used to compare and see if they exist in the original list. This would allow us to create a new list with only the elements that existed in the original list.

def filter_only_strs(lst):

   for x in lst:

       if not isinstance(x, str):

           lst.remove(x)

   return lst

You might be interested in
Consider the following code:
weqwewe [10]

Answer:

252

Explanation:

I tested the code and it outputted 252

hope i helped :D

4 0
3 years ago
What is that black thing on my wall?
Darya [45]
I'm guessing your television if it's a flat screen
7 0
3 years ago
research about the various models of intel processors from the last decade focusing on their speed and cost​
Likurg_2 [28]

The Intel announced the eighth- generation chips will offer up to 40 percent speed boost  over the previous generation.

Explanation:

The most popular Intel processors are the core i3, i5, and i7 product lines. The core i3 is entry level and core i7 processors are the powerful hyper-threaded quad-core options.

The CPU does good job in understanding and completing single tasks. A clock speed of 3.5 GHz to 4.0 GHz is considered a good clock speeding for gaming. It is useful for having good single thread performance.

Intel's prior series of 8086,80186, 80386 and 80486 microprocessors, the first P5 based microprocessor released as original Intel Pentium.

8 0
4 years ago
...............................
Gemiola [76]

............................

Mark me brainliest^^

7 0
2 years ago
Read 2 more answers
Return true if the given non-negative number is a multiple of 3 or 5, but not both. Use the % "mod" operator.
Pani-rosa [81]

the following C++ function will return true if the given non - negative number is multiple of 5 or 3 else it will return false.

bool function( int x ){

// variable to check if it is multiple of both or not

int number =0;

if(3%x == 0){

number++;

}

if(5%x == 0){

number++;

}

// Now returning by deciding

if( number <=1)

return true;

else

return false

}

4 0
4 years ago
Other questions:
  • Which function of a web page relies on responsive web design? Adding extra horizontal scroll Blocking mobile devices from viewin
    11·2 answers
  • You are tasked with securing a small network for a client in which the following requirements must be met: If a user on the priv
    10·1 answer
  • The work principle is not always true<br> T or F
    11·2 answers
  • what is the total resistance of a series circuit with four resistors in series of 12 16 20 and 24 ohms​
    14·1 answer
  • When breaking a problem down, you often encounter elements that you want to use repeatedly in your code. Sometimes it's appropri
    5·1 answer
  • Hey guys im just curious.... whats ur favorite number
    6·2 answers
  • What are other ways you could use the shake or compass code blocks in physical computing projects?
    14·1 answer
  • Write one line Linux command that performs the required action in each of the problems given below: (a) Find the difference in t
    12·1 answer
  • Eric would like to have a callout text box that makes it look as if the character in an image is speaking. Which object should h
    12·2 answers
  • QUESTION 4 of 10: True or False: According to the reading, investors care about your love for your business.
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!