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
Do you humans know what math is?
bogdanovich [222]

Some do some dont Albert einstein has the biggest brain :))

6 0
3 years ago
With which type of test question should you leave yourself extra time to answer?
lapo4ka [179]

Answer:

c

Explanation:

5 0
3 years ago
Read 2 more answers
Ik this isnt an assignment question, but can ya'all friend me? Im lonely ;-; lol
Elan Coil [88]

Answer:hi I’m lonely too

Explanation

:)

4 0
3 years ago
Which data type would you ascribe to a pointer? (unsigned) real (unsigned) integer boolean No answer text provided.
poizon [28]

Answer:

The Unsigned Integer

Explanation:

Solution

The data type i would ascribe to a pointer is the unsigned integer because it can be a pointer (int*number).

The unsigned Integer: they are like integers that is whole numbers, but have the property that they don't contain a + or - sign related with them. thus they are seen as non-negative (zero or positive).

6 0
3 years ago
Which statement is false?If a value should not change in the body of a function to which it is passed, the value should be defin
Norma-Jean [14]

Answer:

Attempts to modify the value of a variable defined const are caught at execution time

Explanation:

The false statement among the options is Attempts to edit the value of a variable defined const are caught at execution time while other options are true.

A const variable should not be modify because the main reason of having a const variable is not to make modifying it possible. If you prefer a variable which you may likely want to modify at some point, then don't just add a const qualifier on it. Furthermore, Any code which modify's a const by force via (pointer) hackery invokes Undefined Behavior

8 0
3 years ago
Other questions:
  • In today's society, unethical actions are: A) Easier than ever to get away with, because the general public and insurers are les
    13·2 answers
  • What is the proper course of action for the following scenario? You want to expand a computer’s capability to play and process v
    8·1 answer
  • What is Administrator windows 10
    8·1 answer
  • 40 is 20 % percent of what?​
    9·1 answer
  • We wish to design a decoder, with three inputs, x, y, z, and eight active high outputs, labeled 0, 1, 2, 3, 4, 5, 6, 7. There is
    5·1 answer
  • Complete the function by filling in the missing parts. The color_translator function receives the name of a color, then prints i
    11·1 answer
  • Impact of computer in society, using relevant examples​
    13·1 answer
  • Free pass if you want it.
    12·2 answers
  • WHAT IS THE LOCATION OF “A”. ON THE GRID?
    15·2 answers
  • Why does brainly say im in highschool when im in middle school?
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!