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
when a picture is downloaded off the internet and then posted to social media, can the social media platform tell it was downloa
Nataly_w [17]
Short answer yes. kinda long answer people can scan the photo and easily see or they can just look up the same image
4 0
3 years ago
The mouse and keyboard are also sometimes called
likoan [24]
Hi!

The mouse and the keyboard are <em>input devices. </em>By using them, we can input data which will give us a (hopefully) desired output!

For example...

Just by using my keyboard to type, I'm inputting data in the form of ASCII characters and symbols.

By using my mouse to click on an area so I can move this sentence on a new line, I had to input a request to do such!

Hopefully, this helps! =)
7 0
3 years ago
What are the values of the following expressions? In each line assume that,
MissTica

Answer:

double x = 2.5;

double y = -1.5;

int m = 18;

int n = 4;

string s = "Storm";

string t = "Watch";

The output of the expression "x + n*y - (x+n)*y" is "6.25".

and the output of expression "m/n + m%n" is "6".

Explanation:

for the first expression,

x + n*y - (x+n)*y ,put value of every variables in it.

=2.5+4*(-1.5)-(2.5+4)*(-1.5)

=2.5-6.0-(6.5*(-1.5)

=-3.5+9.75

=6.25

for the second expression,

m/n + m%n,  put value of every variables in it.

=18/4 +18%4

=4+2      ("/ will give quotient and % will give remainder")

=6

4 0
3 years ago
Providing incentives for customers to learn more about your service is known as?
Julli [10]
B) Advertising is the answer
3 0
3 years ago
Write two statements to get input values into birthMonth and birthYear. Then write a statement to output the month, a slash, and
Montano1993 [528]

Answer:

1/2000

Explanation:

import java.util.Scanner;

public class InputExample {

public static void main(String [] args) {

Scanner scnr = new Scanner(System.in);

System.out.print("Enter birth month and date:");//comment this line if not needed

int birthMonth=scnr.nextInt();

int birthYear=scnr.nextInt();

String output= birthMonth+"/"+birthYear+"\n";

System.out.println(output);

}

}

if using this code the out put should be 1/2000

5 0
3 years ago
Other questions:
  • Who is president is US
    5·1 answer
  • You would set a ___________ to prevent users from immediately changing their password several times in one day to return to the
    15·2 answers
  • Create an array named itemDescription containing the following item descriptions:
    15·1 answer
  • Scott is an aspiring software developer. During an interview for a new job, his prospective employer asks what kind of program h
    12·1 answer
  • A range check that can be used in Microsoft access to calculate the data collected which is date and time
    10·1 answer
  • Label provides the code that executes if no case label is matched ​
    6·1 answer
  • An alternative to configuring individual workstations is to establish configurations dynamically when the computers connect to t
    7·1 answer
  • The function below takes two arguments: a string (name) and an integer (position). Complete the function so that it prints out t
    7·1 answer
  • 45 points!
    10·2 answers
  • What do people in the movie e.t think about the character E.T
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!