At Westonci.ca, we connect you with experts who provide detailed answers to your most pressing questions. Start exploring now! Our platform provides a seamless experience for finding reliable answers from a network of experienced professionals. Experience the convenience of finding accurate answers to your questions from knowledgeable experts on our platform.

Write a function which takes in a list lst, an argument entry, and another argument elem. This function will check through each item present in lst to see if it is equivalent with entry. Upon finding an equivalent entry, the function should modify the list by placing elem into the list right after the found entry. At the end of the function, the modified list should be returned. See the doctests for examples on how this function is utilized. Use list mutation to modify the original list, no new lists should be created or returned.

Sagot :

Answer:

Explanation:

The following code was written in Python and creates a function called add_elements . Whenever it finds the value within the lst that has the same entry it inserts the elem variable right infront of the entry within the list and breaks out of the loop. Finally, the function returns the newly modified list back to the user.

def add_element(lst, entry, elem):

   for value in lst:

       if value == entry:

           lst.insert(lst.index(value) + 1, elem)

           break

   return lst

In this exercise we have to use the knowledge of computational language in python to write the code.

the code can be found in the attachment.

In this way we have that the code in python can be written as:

def add_element(lst, entry, elem):

  for value in lst:

      if value == entry:

          lst.insert(lst.index(value) + 1, elem)

          break

  return lst

See more about python at brainly.com/question/26104476

View image lhmarianateixeira