Write the recursive function flat(aList) that takes a possibly deep list and flattens it. The function should not mutate the original list. Hint: you can check if something is a list by using the built-in functions type() or isinstance [3, [[5, 2, 6, [4]] >>>X flat (x) [3, 5, 2, 6, 4] >>>X [3, [[5, 2, 6, [4]]

Solved
Show answers

Ask an AI advisor a question