Question: The function below has been implemented, but isn't working properly. The docstring is correct. def append.sometimes (1st: List [List [int]], nev: int) List [List [int]l:

 The function below has been implemented, but isn't working properly. The
docstring is correct. def append.sometimes (1st: List [List [int]], nev: int) List

The function below has been implemented, but isn't working properly. The docstring is correct. def append.sometimes (1st: List [List [int]], nev: int) List [List [int]l: """Return a nev list that is the same as , except that has been appended to each sublist that didn't already contain it. 1st1 [[1, 2], [3], [4, 5]1 >>> new-1st1 = append-sometime s (1st 1, 2) >>> new 1st1 >>> 1st1 answer lst for item in answer: if new not in item: item.append (new) return answer We have begun to trace the call to append.sometimes using the example from its docstring. Compl diagram to show the state of memory immediately before append.sometimes returns. diagram that Python uses the shortcut that allows it to create aliases to the same immutable ete the (We assume in the object.) append.somctimes idi s droo lish d2o list id3o id3 --main.- di int lst1 id loo 2. 3 5 Part (b) [1 MARK] Which of the following doctests does the function pass? Circle pass or fail for each. >>> 1st >ne 1st Pass Fail Pass Fail Part (c) [1 MARK] What is the problem with our code? Be specific and use correct terminology

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!