Question: 1) Deep Square 2.0 To flatten a list is to basically take all of the elements found inside a nested list and then having


1) Deep Square 2.0 To "flatten" a list is to basically take all of the elements found inside a nested list and then having these elements stored into a single list. For example, in the nested list below: [[1, [2], [3], [[[4, 5]]],[],[]]] The nested list above will be "flattened" to: [1,2,3,4,5] Notice that the empty lists are omitted. Write a Python recursive function flat_deep_square that also takes in a nested list but returns the squared result of each integer in a flattened list. A sample output is provided below: >>> ([[1, [2], [3], [[[4,5]]],[],[]]]) flat_deep_square [1,4,9,16,25] >>> Note that it may be easier to create a new list to store the integers.
Step by Step Solution
3.46 Rating (156 Votes )
There are 3 Steps involved in it
Python version 36 Python program that creates and test the function flatdeepsquare ... View full answer
Get step-by-step solutions from verified subject matter experts
