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
posledela
4 years ago
10

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.
Engineering
1 answer:
pychu [463]4 years ago
3 0

Answer:

def filter_only_certain_strings(data_list):

   new_list = []

   for data in data_list:

       # fix here. change >= to >  

       # because we want to return strings longer than 5 characters in length.

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

           new_list.append(data)

   return new_list

Explanation:

def filter_only_certain_strings(data_list):

   new_list = []

   for data in data_list:

       # fix here. change >= to >  

       # because we want to return strings longer than 5 characters in length.

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

           new_list.append(data)

   return new_list

You might be interested in
What is the real name of the town that Bud & Bugs stayed in while they were waiting for the train?
Leona [35]

Answer: Hooverville

Explanation:

Bud, not Buddy is a book about a ten years old boy who ran away from home where he stayed with his foster parents. He was treated unfairly and beaten.

He left home to seek a better living and hope that he will find his father as well. He met another orphan named Bugs and they decided to go to Hooverville so that they can get a train going to California.

6 0
3 years ago
A 0.25in diameter copper rod BC is securely attached between two identical 1in diameter steel rods (AB and CD).
sashaice [31]

Explanation:

Below is an attachment containing the complete question and solution

5 0
3 years ago
The heat transfer rate per unit area in a thermal circuit is equivalent to what quantity in an electric circuit? A. voltage B. c
balu736 [363]

Answer:

A. voltage

Explanation:

The rate of heat transfer per unit area in a thermal circuit is equivalent to the voltage in an electrical circuit.

This is because, within an electrical circuit the voltage is supplied by a generator, which can be batteries, batteries, or others. The moment the electrical voltage acts within a circuit, it will consist of the gradient of electrical potential between two points, which will cause the electrons to move from the point with the highest concentration to the point with the lowest concentration (similar to the transfer of heat from the thermal circuit) generating the electric current.

8 0
3 years ago
g Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's representing the integer in bin
Phoenix [80]

Answer:

The solution is written in Python

  1. binary = ""
  2. decimal = 13
  3. quotient = int(decimal / 2)  
  4. remainder = decimal % 2
  5. binary = str(remainder) + binary
  6. while(quotient >0):
  7.    decimal = int(decimal / 2)
  8.    quotient = int(decimal / 2)  
  9.    remainder = decimal % 2
  10.    binary = str(remainder) + binary
  11. print(binary)

Explanation:

Firstly, we declare a variable <em>binary</em> and initialize it with an empty string (Line 1). This <em>binary </em>is to hold the binary string.

Next, we declare variable <em>decimal, quotient </em>and<em> remainder </em>(Line 2-4). We assign a test value 13 to decimal variable and then get the first quotient by dividing decimal with 2 (Line 3). Then we get the remainder by using modulus operator, % (Line 4). The first remainder will be the first digit joined with the binary string (Line 5).  

We need to repeat the process from Line 3-5 to get the following binary digits. Therefore create a while loop (Line 7) and set a condition that if quotient is bigger than 0 we keep dividing decimal by 2 and calculate the quotient and remainder and use the remainder as a binary digit and join it with binary string from the front (Line 9-11).

At last, we print the binary to terminal (Line 13).

4 0
4 years ago
Steep safety ramps are built beside mountain highways to enable vehicles with defective brakes to stop safely. A truck enters a
Virty [35]

Answer:

a) The additional time required for the truck to stop is <u>8.5 seconds</u>

b) The additional distance traveled by the truck is <u>230.05 ft</u>

Explanation:

Since the acceleration is constant, the average speed is:

(final speed - initial speed) / 2 = 0.75 v0

Since travelling at this speed for 8.5 seconds causes the vehicle to travel 690 ft, we can solve for v0:

0.75v0 * 8.5 = 690

v0 = 108.24 ft/s

The speed after 8.5 seconds is: 108.24 / 2 = 54.12 ft/s

We can now use the following equation to solve for acceleration:

v^2 - u^2 = 2*a*s

54.12^2 - 108.24^2 = 2*a*690

a = -6.367 m/s^2

Additional time taken to decelerate: 54.12/6.367 = 8.5 seconds

Total distance traveled:

v^2 - u^2 = 2*a*s

0 - 108.24^2 = 2 * (-6.367) * s

solving for s we get total distance traveled = 920.05 ft

Additional Distance Traveled: 920.05 - 690 = 230.05 ft

5 0
4 years ago
Other questions:
  • What major advancement in machine tools occurred in the 1970s and what benefits did it provide? describe in your own words.
    15·2 answers
  • Vapor lock occurs when the gasoline is cooled and forms a gel, preventing fuel flow and
    7·2 answers
  • What makes a particular sector of the residential construction market dependent on globalization?
    11·1 answer
  • You’re engineering an energy-efficient house that will require an average of 6.85 kW to heat on cold winter days. You’ve designe
    13·1 answer
  • Why does electrical power need to be used as it is created?
    10·2 answers
  • 4 grams of a saturated liquid are converted to a saturated vapor by being heated in a weighted piston–cylinder device arranged t
    10·1 answer
  • Read an excerpt from Benito Mussolini’s "The Doctrine of Fascism.” In the Fascist State, the individual is not suppressed, but r
    7·1 answer
  • The pressure distribution over a section of a two-dimensional wing at 4 degrees of incidence may be approximated as follows: Upp
    9·1 answer
  • A gas within a piston–cylinder assembly undergoes an isother- mal process at 400 K during which the change in entropy is −0.3 kJ
    10·1 answer
  • Air enters a compressor at 100 kPa and 25 ⁰C. It is compressed to 2 MPa and exits the compressor at 540 K. The compressor is at
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!