Question: Write a Python function that takes a list that contains regular elements and other lists and returns a new list that has no sublists (it

Write a Python function that takes a list that contains regular elements and other lists and returns a new list that has no sublists (it is "flattened"). Bonus: make your program be able to deal with lists whose sublists also have sublists.

Example: [[1,2], 3, 4] -> [1, 2, 3, 4] Bonus Example: [[[1, 2], 3,], 4, 5, 6]

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!