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
erma4kov [3.2K]
3 years ago
14

Write the function longest that, given a nonempty list of strings, finds the longest even-length string that ends with ing. It t

akes a list of strings L as input and returns a string. If there are many longest strings, return the first. If there are no such strings, return the empty string (which clearly indicates that no string was found, since a valid string would need to be at least length 3).
Computers and Technology
1 answer:
lorasvet [3.4K]3 years ago
8 0

Answer:

  1. def longest(L):
  2.    for x in L:
  3.        if(len(x) % 2 == 0):
  4.            if(x.endswith("ing")):
  5.                return x  
  6.    return ""
  7. print(longest(["Playing", "Gaming", "Studying"]))

Explanation:

The solution is written in Python 3.

Firstly, create a function longest that takes one parameter L as required by question (Line 1).

In the function, create a for loop to traverse through each string in L and check if the current string length is even (Line 2 - 3). If so, use string endwiths method to check is the current string ended with "ing". If so return the string (Line 4-5).

At last, test the function by passing a list of string and we shall get the output "Gaming".

You might be interested in
Electricity is moved from place to place a long __________​
nexus9112 [7]

Answer:

current of electricity

Explanation:

hope it will help full to you

6 0
2 years ago
Read 2 more answers
Where does change management play a major role in transforming a client
nevsk [136]

To manage a modern IT environment characterized by hybrid complexity and exponential data growth — and to make that same IT a driver of growth and innovation for the business — you need to build intelligence into every layer of your infrastructure.

3 0
3 years ago
NEED ANSWER ASAP. CORRECT ANSWER GETS BRAINLIEST! TY
Tasya [4]

Answer:

scope because the scope will determine the Time for the employee to work

8 0
3 years ago
The spreadsheet below shows how much money each store raised for charity during the months of January, February, and March. A1:
Elenna [48]

Answer:

B2:B4

Explanation:

6 0
2 years ago
Read 2 more answers
What is the output of this Python code?
Simora [160]

Answer:

True

Explanation:

in function guess:- a = x; b = y; c = z

so 45 > 31 AND 45 < 38

since both the stements are true

True is printed

8 0
3 years ago
Other questions:
  • Name some of the file extensions for images and provide more information about one or two of them.
    12·1 answer
  • Which of the following statements is false? a. Classes (and their objects) encapsulate, i.e., encase, their attributes and metho
    15·1 answer
  • What is the chief ethical concern concerning all the new sources of data available through new technological means like internet
    9·1 answer
  • Which best describes the relationship between maximum cost-per-click (max. cpc) bids and ad rank?
    12·1 answer
  • Will a tablecloth that is 155 cm long cover a table that is 1.6 m long?
    12·2 answers
  • The most complex part of ssl is the ___________ protocol.
    7·2 answers
  • Declare an ArrayList of Strings. Add eight names to the collection. Output the Strings onto the console using the enhanced for l
    9·1 answer
  • Discuss five domains of Instructional technology​
    7·1 answer
  • It specifies the amount of memory needed to store data.
    7·2 answers
  • What is a port?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!