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
18. What do we call the Microsoft Word File?
Colt1911 [192]

Answer:

<h2>we call Microsoft Word File "<u>document</u>" or "<u>docx</u>"</h2>
5 0
2 years ago
Someone help me I don’t know what to do /COMPUTER SCIENCE
nydimaria [60]
It kind of depends on the intended language, but I can see the following mistakes:

- lines not terminated with a semicolon (but not all languages require this)
- while statement missing parenthesis, ie., while (num1 <= num2), also not required in all languages
- statements below the while statement must be grouped by curly braces
- num1+5 should be num1=num1+5 or num1 += 5

Output will be:

10
15
20
25
30
5 0
4 years ago
Luke is working on a layout for a catalog. He adds cross lines on the four corners of the layout to mark out a small extra margi
Savatey [412]

Cross lines that are added on the four corners of a layout to mark out a small extra margin is called: D. trim.

<h3>What is layout design?</h3>

Layout design can be defined as a graphical design process that involves the use of one or more grids for the design of a catalog and system, so as to make the designs visually appealing to end users.

In a layout design, trim refers to the cross lines that are added on the four (4) corners of a layout to mark out a small extra margin.

Read more on layout design here: brainly.com/question/13732745

8 0
2 years ago
What is parallelism of microinstruction
Kitty [74]
The answer is Hardware level works upon dynamic parallelism whereas, the software level works on static parallelism. Dynamic parallelism means the processor decides at run time which instructions to execute in parallel,
8 0
3 years ago
What’s the process of observing someone actually working in a career that interests you?
Leni [432]

I think it's called shadowing, or job shadowing to be more specific.

7 0
3 years ago
Other questions:
  • What are the features that can extend record acees beyong Organization-wide defaults?A. Criteria-based sharing rules.B. Owner-ba
    12·1 answer
  • It is appropriate to leave sections of an application blank ?<br><br><br><br> True or False
    7·1 answer
  • The Internet is a hierarchical structure linking different levels of service providers whose millions of devices supply all the
    13·1 answer
  • Given two 3x3 arrays of integer, x1 and x2, write the code needed to copy every value from x1 to its corresponding element in x2
    6·1 answer
  • What do developers do to support software products
    14·1 answer
  • True or False (1 point each)
    9·1 answer
  • A general rule for printing is to use _____ fonts for headlines and serif fonts for body text
    6·1 answer
  • Cycle for science and technology<br>​
    14·1 answer
  • Please help!!
    12·2 answers
  • Which one of the following does NOT contain a
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!