Question: As you know, lists in Python can contain objects of any kind. It is possible, therefore, to have a list which contains another list -a

As you know, lists in Python can contain objects of any kind. It is possible, therefore, to have a list which contains another list -a nested list. You may even have a list like where the elements are nested multiple times, and in no sensible order. Your assignment is to write a recursive function, flattenList(alist), that returns a flattened" version of any given list. That is, all elements (not including lists) of the given list should be in the final, non-nested list in their original order. For example, if the above list was the input, your function should return Your program does not need a main. You do not need to prompt for input from the user; just write the function, and all testing on our part will be done by calling your function with parameters we have defined. Of course, you may test your program however you like
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
