Question: Using recursion that turns 2D (nested) list into 1D list: Ques 7. [14 marks] Write a recursive function the receives a nested list and returns

Using recursion that turns 2D (nested) list into 1D list:

Using recursion that turns 2D (nested) list into 1D list: Ques 7.

Ques 7. [14 marks] Write a recursive function the receives a nested list and returns a flattened version. Examples: Input: [[1]] - Output: [1] Input: [1, [1]] - Output: [1,1] Input: [1, [1], [[2]], [3,[[[4]]]]] - Output: [1,1,2,3,4] Input: [1] - Output: [1]

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 Programming Questions!