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
What economic measure is at the highest level since the Great Depression?
mart [117]
During the Great Depression. ... introduced as they study the Great Depression. Review the ... 1989-1999 appears to have a high degree of price stability with low
3 0
3 years ago
Write a logical expression using only and, or and not that is equivalent to the Exclusive NOR (XNOR) gate on 2 inputs, called in
denis-greek [22]

Answer:

in1 = int(input("Enter value one: "))

in2 = int(input("Enter value two: "))

print(in1,type(in1), in2, type(in2))

if (in1 <=0 and in2 <=0) or (not in1 <=0 and not in2<=0):

   print( True)

else:

   print( False)

Explanation:

The if statement of the python source code is used to implement an Exclusive-NOR logic gate that gives a true or high value if both inputs are either true or false.

5 0
3 years ago
Rob creates a Course_Details table that has four columns: Course _ID, Course_Name, Semester and Credits. A course may have 0.5 c
Digiron [165]
As a<span> </span>primary key<span> is a field in a table which uniquely identifies each row/record in a database table, then the advisable field for the primary key in here should be the Course_ID. That is very unique in that table</span>
7 0
3 years ago
Read 2 more answers
A ____________ would be a misconfiguration of a system that allows the hacker to gain unauthorized access, whereas a____________
Lynna [10]

Answer:

vulnerability, risk

Explanation:

A vulnerability would be a misconfiguration of a system that allows the hacker to gain unauthorized access, whereas a risk is a combination of the likelihood that such a misconfiguration could happen, a hacker’s exploitation of it, and the impact if the event occurred.

6 0
3 years ago
Who was making the high-pitched growling noise that Francisco hears?
Gwar [14]

The high-pitched growling noise that Francisco hears is due to mating call of male midshipman fish or 5G.

<h3>What is the  hum about?</h3>

The Hum is known to be a kind of unexplained happenings that has brought a lot of irritations to people. It is known to be a high-pitched noise that brought a lot of scientific theories.

Studies has shown that the high-pitched growling noise that Francisco hears is as a result of  mating call of male midshipman fish or 5G.

Learn more about noise from

brainly.com/question/2278957

8 0
2 years ago
Other questions:
  • How is a cell named?
    9·1 answer
  • You can use the results from a search on a database in all of these ways except to ____.
    11·2 answers
  • True / False<br> 1. A byte is a standardized unit of measure that is always 8-bits.
    7·1 answer
  • During detachment, _____.
    12·2 answers
  • The merge sort algorithm____________.A. Can be used only on vectors of even length.B. Works by reducing vectors down to the base
    9·1 answer
  • Which panel is used to make a website​
    8·1 answer
  • Think of some local businesses that have websites. Look online and identify two different websites for businesses or services in
    14·1 answer
  • Your friends are having difficulties with their computer setups. Can you suggest a way to help each friend?
    5·1 answer
  • Please help!!
    6·1 answer
  • 30 POINTS FOR THE CORRECT ANSWERS
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!